2

I need to add a tracking pixel for a Facebook ad to my Wordpress site. It should only be active for one blog post, not for every page on the site.

How can I get the script into the HEAD section for the specific post only?

0

1 Answer 1

1

You can use the wordpress Conditional Tags

You can add something like this to your functions.php file:

is_single( 'your-post-slug' )
    add_action( 'wp_head', 'your_function_with_pixel' )

There are a number of different conditional tags you can use. And your-post-slug can be substituted with the post id as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.