Home > Software engineering >  In WordPress. How to insert <meta> tag in the <head> area of a specific page with coding
In WordPress. How to insert <meta> tag in the <head> area of a specific page with coding

Time:04-17

I want to add a meta tag for my site description inside the head area of a specific page before the body tag opens on the WordPress website.

CodePudding user response:

Use hook for wp_head() in your functions.php theme file ( or plugin ).

add_action( 'wp_head', function() {
    
    if ( is_page( 11 ) ) {
        echo '<meta tag... for page_id = 11>';
    }

    if ( is_post( 22 ) ) {
        echo '<meta tag... for post_id = 22>';
    }

});

CodePudding user response:

go to Dashboard > pages > open page with editor go to HTML find the HTML and add your tags if this not works for you edit your Cms and add custom Scripts and make change

  • Related