Viewing 8 replies - 1 through 8 (of 8 total)
  • Please set register_post_type argument to.

    register_post_type(array(
        'rewrite' => array( 'with_front' => false ),
    ));
    Thread Starter MikYF

    (@mikyf)

    I copied this code in the functions.php file of my theme. But it does not work.

    Where I have to put it?

    Thanks.

    I want to set has_archive: true/ with_front: false

    what should i do to do that?

    i have to changes in rewrite.php of plugin fle or functions.php of theme file or any other thing.

    Thanks in advance

    Aishwarya

    Dear Aishwarya/MikYF

    your custom post is probably defined within the themes you are using. So you will need to modify the code where the custom post_type are being declared (see the Other Notes section of this plugin)

    I got it to work for one of my custom post.

    I have a parent theme installed and I have modified it with a child-theme.

    The parent theme creates a custom post type called Listings and I wanted to customise the permalink for this post type.

    I installed this on the my WordPress multisite v4.3.1 and activated the plugin. It enables permalink customisation for all the custom post types found on the site. (See the screenshot on this plugin page).

    Custom Post Registration

    It is important to have has_archive enabled for your custom post registration. The author of the plugin also suggests to enable the rewrite argument. It worked for me even with the rewrite parameter set to false.

    When you open your Settings->Permalink page in the Dashboard, you will see the values of the above 2 arguments displayed below the custom post permalink option field.

    How to modify registration parameters?
    In case you are using a child theme with the custom post declared in parent theme, it is best not to change the custom post registration code of the parent theme, but instead hook the following function in your ‘functions.php’ file.

    add_action( 'registered_post_type', 'enable_rewrite_in_custom_post', 10, 2 );
    function enable_rewrite_in_custom_post( $post_type, $args ) {
      if ( 'listing' === $post_type ) { //change this to your custom post_type slug
        global $wp_post_types;
        $args->has_archive = true;
        $args->rewrite->with_front = true;
        $wp_post_types[ $post_type ] = $args;
      }
    }

    Custom taxonomy terms in permalinks.
    Once you have the custom post correctly registered, you can modify the permalinks for your custom post from your Dashboard page, Settings->Permalink, and add various dynamic options to the permalink.

    For example, my custom post has a custom taxonomy labelled Types. In the Dashboard custom post menu, I can get this custom taxonomy slug from the taxonomy edit page url link. It is listing_type.

    I can then use this in the custom post permalink option field such as
    /%listing_type%/%postname%/
    which will build url links of the form,
    https://<my domain name>/listing/<txonomy Types term slug>/<post slug>

    Plugin Author Toro_Unit (Hiroshi Urabe)

    (@toro_unit)

    Dear Aurovrata Venet

    Thanks!!!

    Hajimemashite Urabe-san,

    I am very happy to contribute to this lovely little plugin.

    Arigato gozaimasu

    Dear Aurovrata Venet ,
    can you tell me how to change the permalinks to more than one language.
    I use the WPJM and Woocommerce and wp-job-manager-wc-paid-listings. I need to translate the slug from “product” to german “produkt” spanisch “
    producto” and more languages. Im using an single site and no childtheme.
    thanks for help

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How does it work?’ is closed to new replies.