• Resolved hammouche

    (@hammouche)


    Hello,

    I have change my permalinks with the code :

    
    add_action("adverts_post_type", "customize_adverts_post_type");
    add_action("adverts_register_taxonomy", "customize_adverts_taxonomy");
    
    function customize_adverts_post_type( $args ) {
        if(!isset($args["rewrite"])) {
            $args["rewrite"] = array();
        }
    
        $args["rewrite"]["slug"] = "viap-community";
        return $args;
    }
    
    function customize_adverts_taxonomy( $args ) {
        if(!isset($args["rewrite"])) {
            $args["rewrite"] = array();
        }
    
        $args["rewrite"]["slug"] = "viap-categorie";
        return $args;
    }
    

    My problem is when I update an post, all my link in wpadvert give me a 404 error, And it will repare when I manually upadate the permalinks of my website.
    Do you have a solution?
    Thank

    • This topic was modified 5 years, 6 months ago by hammouche.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    after adding the code have you went to wp-admin / Settings / Permalinks panel and clicked the “Save Changes” button to reset WP router and apply new URL schemes? If not then you will need to do that.

    Thread Starter hammouche

    (@hammouche)

    Yes, I did and it’s work but this is not my problem.

    My problem is that every time I update a post (advert or not) my custom permalink (taxonomy, post_type) don’t work anymore until I click again on the save change button in the setting/permalink page.

    Plugin Author Greg Winiarski

    (@gwin)

    Hmm i am not sure, we never had similar problem before. One thing i noticed is that you are using an old or customized version of the custom slugs snippet.

    In each function, you are missing an “if” statement at the beginning this might cause a conflict if you have more post types using adverts_post_type filter, see here https://github.com/simpliko/wpadverts-snippets/blob/master/custom-slugs/custom-slugs.php how the function should look like.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Permalink error after update post’ is closed to new replies.