• Resolved lateralleftfield

    (@lateralleftfield)


    Hi,

    Is it possible to change the single listing url from /vehicle/xxxxxxxx to /[custom-name]/xxxxxxxx.

    If so, how can this be done please?

    Can this be changed within any permalink settings?

    Thanks in advance,
    Phil

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter lateralleftfield

    (@lateralleftfield)

    [Resolved]

    Plugin folder/wp-car-manager/src/Vehicle/PostType.php line 64:

    'slug' => _x( 'vehicle', 'post type slug', 'wp-car-manager' ),

    Change ‘vehicle’ to preferred URL.

    All old listing will need to changed.

    Just FYI @lateralleftfield … it’s best to make the changes in your child theme’s functions.php file rather than in the plugin files.

    The below works for me ??

    add_filter( ‘register_post_type_args’, ‘change_args_for_wpcm_vehicle_posttype’ , 10, 2 );
    function change_args_for_wpcm_vehicle_posttype( $args, $post_type ){

    // Do not filter any other post type
    if ( ‘wpcm_vehicle’ !== $post_type ) {
    // Give other post_types their original arguments
    return $args;
    }

    // Change the slug of the “wpcm_vehicle” post_type
    $args[‘rewrite’][‘slug’] = ‘used-car’;

    // Give the wpcm_vehicle post type it’s arguments
    return $args;

    }

    I’ve changed the slug to “used-car”

    Cheers

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Single Listing – URL – Currently /vehicle/ – How to change’ is closed to new replies.