0

I am trying to modify the default 'post' within WordPress and change it to Projects. I cannot get it to work. I don't want to create a new CPT. I just want to modify the functionality of the existing one.

Here is my code:

function change_default_wp_post() {

         $labels = array(
            'name'                  => _x( 'Projects', 'post type general name', 'burst-portfolio' ),
            'singular_name'         => _x( 'Project', 'post type singular name', 'burst-portfolio' ),
            'menu_name'             => _x( 'Projects', 'admin menu', 'burst-portfolio' ),
            'name_admin_bar'        => _x( 'Project', 'add new on admin bar', 'burst-portfolio' ),
            'add_new'               => _x( 'Add New', 'portfolio', 'burst-portfolio' ),
            'add_new_item'          => __( 'Add New Project', 'burst-portfolio' ),
            'new_item'              => __( 'New Project', 'burst-portfolio' ),
            'edit_item'             => __( 'Edit Project', 'burst-portfolio' ),
            'view_item'             => __( 'View Project', 'burst-portfolio' ),
            'all_items'             => __( 'All Projects', 'burst-portfolio' ),
            'search_items'          => __( 'Search Projects', 'burst-portfolio' ),
            'parent_item_colon'     => __( 'Parent Projects:', 'burst-portfolio' ),
            'not_found'             => __( 'No projects found.', 'burst-portfolio' ),
            'not_found_in_trash'    => __( 'No projects found in Trash.', 'burst-portfolio' ),

            'featured_image'        => __( 'Project Image', 'burst-portfolio' ),
            'set_featured_image'    => __( 'Set Project Image', 'burst-portfolio' ),
            'remove_featured_image' => __( 'Remove Project Image', 'burst-portfolio' ),
            'use_featured_image'    => __( 'Use Project Image', 'burst-portfolio' ),
        );

         $args = array(
             'label'                 => __( 'Portfolio', 'burst-portfolio' ),
             'labels'                => $labels,
             'menu_icon'             => 'dashicons-portfolio',
             'public'                => true,
            //  'supports'              => $features,
             'rewrite'               => array(
                 'slug'                => __( 'portfolio', 'burst-portfolio' ),
                ),
            );

            register_post_type_args( $args, 'post');
    }

     add_action( 'init', 'change_default_wp_post');
1

This is not advisable to do. A lot of things in WordPress depend on having posts and pages acting as they are. You can change labels, but, changing other settings will very likely break something.

It is much better to create new post type, then messing up posts or pages.

Also, the function you used 'register_post_type_args' doesn't exist in the WordPress, it is either part of some plugin you have, or it will throw errors. WordPress has 'register_post_type' function, but that can't be used to modify parts of the post type.

  • Ok thanks, in that case, is it possible to customise the built-in post type to change labels using the rregister_post_type_args function? – Eric Trometer Oct 20 '17 at 16:20
  • Also to be clear I don't need the post or blog I just want to convert them to another type without having to create a new CTP. So I can use certain themes I already have without having to reconfigure lots of CTP specific pages – Eric Trometer Oct 20 '17 at 16:27
  • 2
    I don't quite understand what you want to do here, it looks like more than one question here, but, as I said in my answer it is a bad idea to mess with the post and page types. – Milan Petrovic Oct 20 '17 at 16:31
  • Why do you want to change posts to projects if your theme uses posts? Is it for the permalink? Is it to avoid converting your posts into projects? Maybe there's a better solution to your problem... – Victoria Ruiz Oct 20 '17 at 19:48
  • The reason for changing it to projects is for End User Interaction as there will not be any posts just projects. Simply! In a way maybe I am not messing with the functionality, but more interested and replacing all the labelling and wording across the whole platform for end-user clarity! – Eric Trometer Oct 22 '17 at 8:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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