简体   繁体   中英

Custom post type permalink remove

I want to remove the custom post type name of the permalink.

I created a custom post type like this:

    add_action( 'init', 'register_projects' );
    function register_projects() {
        register_post_type( 'proyectos_post',
            array(
                'labels' => array(
                    'name' => __( 'Proyectos' )
                ),
                'public' => true,
                'supports' => array( 'title', 'editor'),
                'hierarchical' => true,
                'menu_position' => 4
            )
        );
    }

The problem is that when I enter to a post, the url gets: www.myweb.com/proyectos_post/mypost

I want it to be like this: www.myweb.com/mypost

Is it possible to do it without external plugins?

Try this. 'rewrite' => array('slug' => 'custom-post-name', 'with_front' => FALSE)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM