WordPress.org

Forums

Custom Permalinks (taxonomy) break Links for "static" pages (2 posts)

  1. mark-up
    Member
    Posted 1 year ago #

    Hello Everybody,

    I ran into some trouble by creating custom permalink structures for a custom taxonomy: It breaks the permalinks for all the static pages (cantact, about me...).

    What I did:
    1. I changed the permalink rules in the WP-admin backend to
    "/%customtax%/%category%/%postname%/"

    2. and set up a hook like this (shortened):

    function custom_tax_link($post_link, $id){
    		// modify the post_link
    		(...)
    		return str_replace('%customtax%', $taxonomy_slug, $post_link);
    	}
    	add_filter('post_link', 'custom_tax_link', 10, 3);

    This works fine for all posts.. **BUT** it breaks the links for all pages.

    I guess what i did wrong is setting the "%customtax%" in the WP Backend (1), but I don't know how to do this in the functions.php (?) and ONLY for posts (not pages).
    How do I have to do this?

    Thanks for ideas, help and infos! :-)
    Mark

  2. mark-up
    Member
    Posted 1 year ago #

    Hello again,

    I'm realy stuck with this issue.. :( Some Ideas how to handle this problem would be great... Please HELP! :)
    Thanks
    Mark

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.