The problem was that the remove_filter function wasn’t working. Apparently this is not uncommon from what I’ve read. I tried testing it with different priorities (1, 9, 20, 999), but there was no difference.
So my filter in the child theme and the filter I was trying to remove from the parent theme both had the same priority. WP loads the child theme’s functions.php right before the parent’s so I’m guessing that’s why my filter was not taking effect because it was happening first and then being filtered again by the parent’s.
Anyways, my solution was simply to change the priority of my add_filter function to 11, like so:
add_filter('single_template', 'single_template_override', 11);
Related Posts:
- Load different template file when condition met?
- How Can I Have A URL Changed Based on the Originating URL?
- How to add attributes to tag when template cannot be directly modified
- Custom Post Templates
- theme_page_templates not working
- I can not include page to wordpress function add_filter, the_content
- Adding a filter to comments_template
- Change the template when the user is not logged in using page_template filter (it does not work)
- Redirect after post deleted
- Shortcode / plugin with custom (flexible) output
- output custom Posts on a Page
- How to redirect template_directory to subdomain relativ url?
- Would like to use hook or filters to customize email templates
- How can I filter same content in page
- the_content filter not working when Jetpack activated. Any idea?
- Show child theme for users on specific IP
- if i put the code in my theme’s function.php file can it work?
- How could I create real-time filtering in this case?
- what is __return_false in filters
- Custom theme hooks / filters – passing arguments
- Change upload directory on custom plugin page
- What params are available with the_content filter?
- How to hook wp_list_pages?
- Don’t replace “|” with Empty String (“”) when generating slugs from title
- apply_filters(‘the_content’, $content) alternative
- How to use the_excerpt in a filter hook?
- Changing document title only on a custom page template
- Shortcodes not resolved in AJAX call response
- Create single.php for specific category by category id
- filter title from shortcode
- Add a Span Around a Product Title in WooCommerce [closed]
- How to get list of all hooks of current theme / plugin?
- get_query stops working after post filter
- How to filter into post meta data before saving
- Adding custom column to comments admin panel?
- Filter out some plugin action in wp head / wp_footer
- is there a specific place where add_filter must be placed?
- add_filter() function misunderstanding
- How to make a widget expand wider than the column width when editing its settings in the admin
- Is there a wildcard/catchall filter hook?
- Apply the_content filter, but prevent other hooked actions
- Can the wp_filter object hold multiple values with the same key
- apply_filters/do_action tag characters limit
- the_excerpt filter with an empty excerpt
- Modify a function without editing template
- Add Defer Attributes to WordPress Scripts with consistent versioning
- How to stop wrapping comments in P tag
- Remove CSS & JS files from WordPress Main Page For Increase Pagespeed?
- String regex match replace for role ‘contributor’ only
- Can plugins that filter post contents work on posts from Word 2007?
- html tags in gettext hook get escaped
- Set default terms for new posts / CPTs
- Get .subsubsub count of post per status queried using pre_get_posts
- How to show “teaser” posts on blog / archive pages, otherwise full posts
- Better extend a class or use add filter/action hooks?
- Adaptive product filters for WooCommerce
- Adding a Clone link to product attributes – post_row_actions() filter, or how to override a Class question
- wp_upload_bits Upload Specific Sizes Only
- How can I replace an oEmbed URL in post with actual embed HTML
- Add a filter inside an action init
- How to display the content HTML of a page without displaying the gallery code as well
- Is it possible to apply_filter on a wp_ajax_ action?
- Apply filters with multiple filters
- Using add_filter to prepend content, result is out of order
- Remove Comment Author Link only for subscribers
- get_posts() interrupt because of filter
- WooCommerce coupon hook argument NULL when using filter woocommerce_get_shop_coupon_data
- How can I edit comment meta value before it is saved?
- Why current_user_can(‘edit_comment’) always true?
- Disable sanitize_file_name on upload without modifying functions.php
- How to stop filter from running on the index.php page?
- Filter Media by attached page or blog post in Library
- How to stop DOMDocument destroying embeds?
- How to modify image caption in posts?
- Extend Nonce Lifetime for Specific Nonce Creation
- Run `wp_insert_post_data` on all posts
- How can I pass instance via apply_filters as a parameter?
- Consult array data in REST API Filter
- WordPress add_filter to post_date
- create a shortcode with acf including a filter
- Custom permalink for attachment
- Overriding Generated Attachment Post URL
- Pagination while keeping the filters
- Apply a filter str_replace on specific caracters array in the_content()
- using filters on the function from class
- Put data in my-account/view-order/id/ page
- The title of an attachment is not working
- add_filter not adding the filter
- Hide H1 Title using the_title filter
- Filter image and text from post format
- Filter posts by multiple checkbox categories
- Remove pipe in views admin page filter
- Hooking/Filtering theme name to add theme directory
- Passing value from one hook to another
- posts_results filter – additional sort, with a meta value, to move posts to the end of the results, with pagination working
- How to use parse_query() to add an additional filter based on content to page search?
- FacetWP was unable to auto-detect the post listing : Having an issue with ACF load choices causing FacetWP error
- add_filter – create_function pb in PHP8
- How to filter products by category in custom loop
- Filter hook for the action of listing users