Support » Plugins and Hacks » Hacks » Custom Post Types and add_rewrite_endpoint doesn't work together

  • akis

    (@akis)


    Hello,

    There are any chances to use add_rewrite_endpoint on a custom post_type?
    Seems to work well on general posts but on custom ones it gets redirected to canonical url.

    Also, after disable the canonical redirect everything is well. But I want to keep that filter.
    remove_filter('template_redirect', 'redirect_canonical');

    Any thoughts? Here’s my code:

    function add_q_var() {
        global $wp;
        $wp->add_query_var('test');
    }
    
    add_filter('init', 'add_q_var');
    add_rewrite_endpoint('test', array(EP_NONE));

    Thank you.

  • The topic ‘Custom Post Types and add_rewrite_endpoint doesn't work together’ is closed to new replies.