How to run a PHP snippet only on the pages where I need it?
-
Hello,
I added a PHP snippet to hide the page titles on my category archive pages like this one here: https://mayangateway.com/category/guatemala-tours/ as you can see in this page, it works, the title is hidden.
However, I want to run the PHP snippet only on my category archive pages, not in the entire website. I tried to do the following options:
1. Auto Insert → Frontend Conditional Logic + Enable Logic → Conditions → Show Page URL → is (a few rules with the pages where I need the snippet)
2. Auto Insert → Frontend Only + Enable Logic → Conditions → Show Page URL → is (a few rules with the pages where I need the snippet)After doing each combination, I erased all caches. But none of those options work. At the moment I am using: Auto Insert → Frontend Only without enable logic to make it work.
Here is the PHP snippet:
add_action( 'wp', 'lh_remove_archive_title' ); function lh_remove_archive_title() { remove_action( 'generate_archive_title', 'generate_archive_title' ); }
How can I run the PHP snippet only in the pages where I need it?
Thank you in advance for your help.The page I need help with: [log in to see the link]
- The topic ‘How to run a PHP snippet only on the pages where I need it?’ is closed to new replies.