Custom Rewrite with Query vars

Add a rewrite endpoint instead of a rewrite rule and query var. This API function will do both of these things for you.

function wpd_add_my_endpoint(){
    add_rewrite_endpoint( 'information', EP_PAGES );
}
add_action( 'init', 'wpd_add_my_endpoint' );

Now any page can have information appended to the end, and the value will be available via get_query_var('information').

Leave a Comment