I am using the accepted answer shown here: Apply the_title() filter in post & page title, but not in menu title
For some reason, the code is getting through this if statement twice:
if ( ! is_admin() && $ post instanceof WP_Post && ( $ post->post_type == 'page' ) && in_the_loop() && is_main_query() ) {
I am already using the pre_wp_nav_menu
and wp_nav_menu_items
filters as shown on that answer.
What would be making this code run twice please? Or how would I debug to find out what is calling it and letting it through the if twice?
(When I use debug_backtrace()
is shows apply_filters
line 212 in plugins.php both times but I’m not sure what to do with that info)
Sorry, I would ask as a follow-up on the posted question, but I evidently can’t comment yet.