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 to add a custom CSS class to core blocks in Gutenberg editor?
- No filter of code on switch from html to visual editor, how?
- How to modify posts_where filter only for the search query
- How to auto-translate custom user roles?
- Adding revision support to WooCommerce product content
- Changing text within the Block Editor
- add_filter for specific pages
- How to add attribute to output with wp_video_shortcode add_filter
- Change default settings used by gallery shortcode
- Please explain me what the do_action does
- Is it possible to Hook/Filters Attachment Creation?
- Customize WooCommerce Error Message
- Dump contents of a variable inside a filter/hook callback that runs during save post
- Customize user account activation message
- Conditionally call add_action depending on post_type?
- Allow users to exclude categories? (WP 3.1.2)
- Replace a part of url generated by get_term_link
- Error when overriding only some audio shortcode HTML output
- Filter category in WooCommerce shop page to display related sub-category
- Run oembed separately outside the_content()
- Where can you find the available filter tags?
- Is possible dequeue/remove style from wp_footer() hook and add on wp_head() hook?
- Removing an action, or dequeueing style – Both not working
- Where is the changelog for 3.5? where is the list of added removed files?
- Move a file from a directory to another
- When does wordpress process <!–nextpage–>
- Remove style `?ver=` from `/wp-admin/upgrade.php`
- Redirect to checkout woocommerce failed
- Filter the regular price of woocommerce products
- remove action from AMP plugin
- Correct way to filter get_pages() function
- wp_insert_post_data filter hook identify current action
- Add Class to a div using a filter?
- How to link the whole list item in Gutenberg’s latest posts block?
- Remove Extra Classes from Post Title
- Upload file if contains certain name
- Filters/Bulk Actions return wrong URL in admin dashboard
- I want to allow the use of a data-flw attribute in links in comments
- What hooks to hook onto for automatic cache clearing
- Add filter menu to admin list of posts (of custom type) to filter posts by custom field values
- How can I output all apply_filters and do_action?
- Override has_post_thumbnail function
- How to allow code block in wordpress comments
- remove_action: how to access to a method in an child class?
- Set default value for “Additional CSS class(es)” for specific block types
- Woocomemrce order and registration fileds to UPPERCASE
- add_filter to wp_nav_menu_objects having no impact
- Trimming a custom field to a length
- Filter content for get_the_content()
- Using add_filter to modify a public function of a class
- How to hide/remove GhostKit component panel in gutenberg block inspector
- WordPress removing slashes from shortcode output
- when use function the_content break
- conditional search
- Filter “Your latest posts”
- Sql query does not work well
- Hide certain product filters from specific product categories
- WordPress Gutenberg core/heading block (wp-block-heading)
- Add an attribute to the root from functions.php with add_filter
- Removing menus from users other than the administrator
- Can’t understand apply_filter logic
- Apply pre_get_posts filter in a certain moment (just for a particular block of posts)
- Modify oembed code conditionally
- How to Change the WordPress Locale with the ‘locale’ Filter?
- meta box loop problem with a search filter
- How can I add a prefix to titles displayed in sidebar using function.php?
- Modify Default URL for /wp-includes/js/wp-emoji.js?ver=4.6.1
- List all image sizes still getting disabled sizes
- wp_editor customization
- What problems could happen if I replaced add_filter and add_action with the function calling
- DIVs not showing correctly on CPT?
- posts_results filter function memory errors
- Adding to an array & passing it through do_action/apply_filters
- Activate short codes for all post queries?
- Save something to global var in add_filter
- Loading a sidebar on an Ajax call
- the_excerpt() does not work with has_excerpt()?
- Wrapping Featured Image on Add/Edit Page in div?
- how to localize the number of wordpress post views?
- How do you disable the verification process of user email changes?
- Modify the third (context) parameter in a filter?
- Filter a custom post type by custom field in admin
- Search and Filter Using Custom Post Type, Custom Taxonomy, and Advanced Custom Fields