WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Types and add_rewrite_endpoint doesn't work together (1 post)

  1. akis
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic