Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've registered post type with following --

$holidayLabels = array(
    'name' => __( 'Holidays'),
    'singular_name' => __( 'Holidays'),
    'all_items' => __( 'All Holidays'),
    'add_new' => __( 'Add New Holiday'),
    'add_new_item' => __( 'Add New Holiday'),
    'edit_item' => __( 'Edit Holiday'),
    'new_item' => __( 'New Holiday'),
    'view_item' => __( 'View Holidays'),
    'not_found' => __( 'No Holidays found'),
    'not_found_in_trash' => __( 'No Holidays found in Trash'),
    'parent_item_colon' => ''

);

$holidayArgs = array(
    'labels'               => $holidayLabels,
    'public'               => true,
    'publicly_queryable'   => true,
    '_builtin'             => false,
    'show_ui'              => true,
    'query_var'            => true,
    'rewrite'              => array( "slug" => "holidays" ),
    'capability_type'      => 'post',
    'hierarchical'         => false,
    //'menu_position'        => 6,
    'supports'             => array( 'title'),
    'has_archive'          => false,
    'show_in_nav_menus'    => false,

);
register_post_type('holidays', $holidayArgs);

And I want to remove permalink that appears below title when I post new holiday or start editing existing one. enter image description here

I want to remove this because, holidays will be displayed in separate widget. I don't want admin to be able to see it as single post anyhow. There's no template defined for such.

share|improve this question
    
Do you want them to have archive page and to be able to access them with permalink? –  Krzysiek Dróżdż Aug 1 '13 at 18:46
    
@KrzysiekDróżdż no. that's why I want to remove permalink. There's no such page available. Holidays will be shown in widget itself and details with ajax in modal. –  SachinG Aug 1 '13 at 18:50
    
So you should also take care of disabling permalinks, archives, and so on. Take a look at my answer ;) –  Krzysiek Dróżdż Aug 1 '13 at 19:09
add comment

2 Answers 2

up vote 1 down vote accepted

Well, there is another way. And better, I guess.

You should look at register_post_types parameters. You should probably set them like this:

'public' => false,  // it's not public, it shouldn't have it's own permalink, and so on
'publicly_queriable' => true,  // you should be able to query it
'show_ui' => true,  // you should be able to edit it in wp-admin
'exclude_from_search' => true,  // you should exclude it from search results
'show_in_nav_menus' => false,  // you shouldn't be able to add it to menus
'has_archive' => false,  // it shouldn't have archive page
'rewrite' => false,  // it shouldn't have rewrite rules

If post type is not public, then you won't see this part of editor.

share|improve this answer
    
yea! setting public to false does it. Other options are also useful in this case. Thank you very much. :) –  SachinG Aug 1 '13 at 19:20
add comment

Well, one quick way would be to just hide the container div using CSS.

add_action('admin_head', 'wpds_custom_admin_post_css');
function wpds_custom_admin_post_css() {

    global $post_type;

    if ($post_type == 'post_type') {
        echo "<style>#edit-slug-box {display:none;}</style>";
    }
}
share|improve this answer
    
that's surely one way to do this. But I was wondering for admin filter or something. But this does work and thank you. –  SachinG Aug 1 '13 at 18:43
add comment

Your Answer

 
discard

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.