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

There are lots of situations where a theme or plugin registers a post type and you want to modify it. There is of course add_post_type_support() and remove_post_type_support(), but those don't give access to the full list of arguments that register_post_type() takes. In particular, maybe I want to disable a post type archive, hide the admin UI, hide from search, etc. while leaving the rest of the post type settings alone.

The Codex page for register_post_type() dangles this in front of me:


Create or modify a post type.

But in the past, when I've try to do this, it hasn't seemed to work. Is this function really for modifying post types, and if so, can you simply redeclare a couple arguments and leave the rest alone?

Seeing that there isn't even a deregister_post_type() function, I don't understand how it can be done.

share|improve this question
up vote 13 down vote accepted

Is this function really for modifying post types


and if so, can you simply redeclare a couple arguments and leave the rest alone?

No. If you want to modify arguments to a post type, you need to use get_post_type_object to get the post type object, modify what you want in it, then re-register it using your modified type as the new $args parameter.

share|improve this answer
Would making two consecutive calls with modified arguments to the same register_post_type be correct? I assume so by your "Yes.", and it doesn't dumps any errors and has the desired effect. The real case is the second option I present in this answer: wordpress.stackexchange.com/a/74331/12615 – brasofilo Nov 29 '12 at 14:54
Yes, that works, but it seems like if you're having to do that, then you need to add some filters or something else to prevent having to repeatedly register the same post type over and over again. Basically, get the arguments sorted out first, then register it. – Otto Nov 29 '12 at 19:13
I just thought about it because of the hook provided just before the plugin's register_post_type. In reality, there's no need. It was a "for the records" question, thanks for the feedback. – brasofilo Nov 29 '12 at 19:22

Here's an example of how to use the 'registered_post_type' filter to modify a post type in another plugin.

A plugin I was using didn't include a menu_icon in it's definition, so I wanted to add one of my own.

 * Add a menu icon to the WP-VeriteCo Timeline CPT
 * The timeline plugin doesn't have a menu icon, so we hook into 'registered_post_type'
 * and add our own.
 * @param  string $post_type the name of the post type
 * @param  object $args the post type args
function wpse_65075_modify_timeline_menu_icon( $post_type, $args ) {
    // Make sure we're only editing the post type we want
    if ( 'timeline' != $post_type )

    // Set menu icon
    $args->menu_icon = get_stylesheet_directory_uri() . '/img/admin/menu-timeline.png';

    // Modify post type object
    global $wp_post_types;
    $wp_post_types[$post_type] = $args;
add_action( 'registered_post_type', 'wpse_65075_modify_timeline_menu_icon', 10, 2 );
share|improve this answer
This is a much cleaner way to do it in most cases; however, it should be noted that this filter is too late to get picked up by rewrites so the accepted answer must be used instead in those situations. – mrwweb Mar 17 '15 at 22:44

Hook into 'registered_post_type' after the other code has registered it. It is called at the end of register_post_type(). You get two arguments: $post_type and $args.
Now you can change anything for this post type. Inspect $GLOBALS['wp_post_types'] for some options.

share|improve this answer
Thanks for pointing me toward that hook. That answers the (more important) question about how to modify a post type, but what about the description of register_post_type() that includes "modify?" Is that just wrong? Should I hop on my internet horse and vanquish it from the Codex this moment? – mrwweb Sep 13 '12 at 16:32
$wp_post_types[$post_type] = $args; … suggests that you should be able to change the properties. Add an example of the failing code to your question. – toscho Sep 13 '12 at 16:36

After some research I found none of these answers are up to date.

As of December 8, 2015 WordPress includes a new filter, register_post_type_args, which lets you hook into the arguments of a registered post type.

function wp1482371_custom_post_type_args( $args, $post_type ) {
    if ( $post_type == "animal-species" ) {
        $args['rewrite'] = array(
            'slug' => 'animal'

    return $args;
add_filter( 'register_post_type_args', 'wp1482371_custom_post_type_args', 20, 2 );
share|improve this answer

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.