Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author methnen

    (@methnen)

    There’s a few ways to do this that don’t actually require any changes to the plugin.

    Basically you just need to change it before it gets created in WP.

    Something like this added to your functions.php file should work:

    <?php
    
    add_filter( 'm-chart_post_type_args', 'm_chart_post_type_args' );
    
    function m_chart_post_type_args( $args ) {
        $args['rewrite']['slug'] = 'your-new-slug-here';
       
        return $args;
    }
    Thread Starter datverse

    (@datverse)

    Hi,
    Thank for your reply. I should use “register_post_type_args” “filter” and it work ??

    add_filter( 'register_post_type_args', 'm_chart_post_type_args', 10, 2 );
    
    function m_chart_post_type_args( $args, $post_type ) {
    
    	if ( 'm-chart' === $post_type ) {
    		$args['rewrite']['slug'] = 'foo-chart';
    	}
    
    	return $args;
    }

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change default Slug “chart”’ is closed to new replies.