HOME / BLOG / BLOG-POST

How to insert code to header for a specific page only in wordpress?

/**
* adding scripts for specific page/post with page id=17 (wpdevkt.in)
*/
function schemas_for_specifice_page(){
    global $post;
    if($post->post_type == 'page' && $post->ID == '17'){
       echo 'Your code here';
    }
}
add_action('wp_head','schemas_for_specifice_page');

 


about authors

Sandip Das

Web Developer

Once a legend said “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.” – Martin Fowler.



POST COMMENTS

Leave a Reply

Your email address will not be published. Required fields are marked *