Reputation: 134
How to remove parent themes function file filter in child themes function file.
function file
function add_opengraph_doctype( $output ) {
return $output. ' prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#"';
}
add_filter('language_attributes', 'add_opengraph_doctype');
And I have try to remove child theme like as
remove_filter('language_attributes', 'add_opengraph_doctype');
but it's not working.
Upvotes: 1
Views: 1909
Reputation: 380
You can set priority in your filter like this :
add_filter('language_attributes', 'add_opengraph_doctype', 10);
and set child them filter priority to grater than 10.
Upvotes: 0
Reputation: 60517
A child theme's functions.php
file will run before the parent, so it will not be registered yet.
You could wait for the init
action to remove the filter.
function remove_language_attributes() {
remove_filter('language_attributes', 'add_opengraph_doctype');
}
add_filter('init', 'remove_language_attributes');
Upvotes: 5