I’m trying to unregister a post type from a child theme but I haven’t been able to do so, the code in the funcions.php file on the parent theme is something like this:
add_action( 'init', 'mc_projects' );
function mc_projects() {
register_post_type( 'project', array(
// Default options....
) );
}
What I tried to do in my child theme was to remove the mc_project action from the init hook like this:
remove_action('init', 'mc_projects', 11);
But it didn’t work, even when I set the priority to some higher value, am I doing something wrong?
Try the following in your child theme functions file.
This helped me.
Credit goes to http://www.jasonpaul.net
Here’s another solution, abeit a bit hackish –
In my parent theme, my custom post type is created like so:
Then, in my child theme, I simply re-declare the function as empty –
Hope this helps! This is my first contribution to a forum like this so please excuse any formatting rules I’ve broken.
no one above not work for me in WordPress 4.9.7 but this solve my problem
This worked for me.