WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
If i remember correct the the priority must match between both add_action and remove_action calls. – Bainternet Jun 6 '11 at 22:52
To add some info: Default priority is 10. – kaiser Jun 7 '11 at 17:07
Oh I thought it had to be higher than the action I wanted to remove, I'll try that – javiervd Jun 7 '11 at 19:04
No luck, could it be because the functions file on the child theme gets loaded before the parent theme functions? So I'm trying to remove an action that hasn't been declared yet? – javiervd Jun 7 '11 at 19:08
up vote 3 down vote accepted

Try the following in your child theme functions file.

add_action( 'init', 'remove_mc_projects' );
function remove_mc_projects() {
    remove_action('init', 'mc_projects');
share|improve this answer

This helped me.

add_action( 'after_setup_theme','remove_project_custom_init', 100 );

function remove_project_custom_init() {
    remove_action( 'init', 'project_custom_init');

Credit goes to www.jasonpaul.net

share|improve this answer
This seems to be the right solution, when trying to run the "remove_project_custom_init()" on 'init', the function does nothing. It has to run on action 'after_setup_theme' to remove the parent theme function. – Lars Koudal Nov 4 '14 at 20:24
Many thanks... worked perfectly – jadik Aug 30 '15 at 22:46

Here's another solution, abeit a bit hackish -

In my parent theme, my custom post type is created like so:

if (!(function_exists('my_post_type')))
    function my_post_type()

Then, in my child theme, I simply re-declare the function as empty -

function my_post_type() { }

Hope this helps! This is my first contribution to a forum like this so please excuse any formatting rules I've broken.

share|improve this answer
Formatting perfectly fine. :) Hackish meets it ;) – kaiser Feb 20 '12 at 15:17
brilliant in its simplicity, thanks! – Piet Jan 24 '13 at 14:07

This worked for me.

function override_parent() {
remove_action( 'init', 'mc_projects', 0 );
add_action ('after_setup_theme','override_parent');
share|improve this answer
Please add an explanation to your answer: why could that solve the problem? – toscho Sep 8 '14 at 14:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.