Support » Plugin: WPAdverts - Classifieds Plugin » Url adjustments

  • Resolved Reobed


    I want the urls in the site to present the actual permalink of the advert message

    The url right now is :
    but I want it to represent the value that has SEO value so :

    The part verloren/amsterdam/bike
    is already in the title, and if I hover over the Title in the advert is shows :
    [Permanente link : Verloren in Nederland, Amsterdam: Bike ]

    Reason is to get as much SEO value in my url, which should also correspond as much as possible with Title

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Greg Winiarski


    this is not possible in WPAdverts by default, and as far as i know WordPress does not support such links out-of-box as well.

    I did some research and it looks like with some additional custom programming you can create links like that. There is a code snippet which explains how to do that here You will, of course, need to modify it to use the ‘advert’ post type and advert_location taxonomy.

    You can also use a plugin, but it looks like it will not allow you to have a permalink scheme exactly as in your example.

    Plugin Author Greg Winiarski


    Here is a whole code to convert the permalinks from to

    // Add our custom permastructures for custom taxonomy and post
    add_action( 'wp_loaded', 'add_advert_permastructure' );
    function add_advert_permastructure() {
        global $wp_rewrite;
        add_permastruct( 'advert', 'advert/%advert_location%/%advert%', false );
    // Make sure that all links on the site, include the related texonomy terms
    add_filter( 'post_type_link', 'custom_advert_permalinks', 10, 2 );
    function custom_advert_permalinks( $permalink, $post ) {
        if ( $post->post_type !== 'advert' ) {
            return $permalink;
        $terms = get_the_terms( $post->ID, 'advert_location' );
        if ( ! $terms ) {
            return str_replace( '%advert_location%/', '', $permalink );
        $post_terms = array();
        $taxonomy = "advert_location";
        $term = $terms[0];
        do {
            $post_terms[$term->term_id] = $term->slug;
            $term = get_term( $term->parent, $taxonomy );
        } while( !$term instanceof WP_Error );
        $post_terms = array_reverse( $post_terms );
        return str_replace( '%advert_location%', implode( '-', $post_terms ) , $permalink );

    The code you can add in your theme functions.php file, after adding it go to wp-admin / Settings / Permalinks panel and click the “Save Changes” button to reset WP router and apply new URL schemes.

    we’ll give it a try !

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.