WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/04/2010 04:58:43 PM (10 years ago)
Author:
ryan
Message:

More custom post type support. Props scribu. see #9674

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/post.php

    r12377 r12597  
    127127    $post_ID = $p = (int) $_GET['post'];
    128128    $post = get_post($post_ID);
     129    $post_type_object = get_post_type_object($post->post_type);
    129130
    130131    if ( empty($post->ID) )
     
    137138        wp_die( __('You can’t edit this post because it is in the Trash. Please restore it and try again.') );
    138139
    139     if ( 'post' != $post->post_type ) {
     140    if ( null == $post_type_object )
     141        wp_die( __('Unknown post type.') );
     142
     143    if ( 'post' != $post->post_type && $post_type_object->_builtin ) {
    140144        wp_redirect( get_edit_post_link( $post->ID, 'url' ) );
    141145        exit();
     146    }
     147
     148    $post_type = $post->post_type;
     149    if ( 'post' != $post_type ) {
     150        $parent_file = "edit.php?post_type=$post_type";
     151        $submenu_file = "edit.php?post_type=$post_type";
    142152    }
    143153
     
    158168    }
    159169
    160     $title = __('Edit Post');
     170    $title = sprintf(__('Edit %s'), $post_type_object->label);
    161171    $post = get_post_to_edit($post_ID);
    162172
Note: See TracChangeset for help on using the changeset viewer.