my code is like that:

function add_rewrites(){
add_action( 'init', 'add_rewrites' );

function add_custom_query_var( $vars ){ 
$vars[] = "sub_pages"; 
return $vars; 
add_filter( 'query_vars', 'add_custom_query_var' );

My question is:$my_post_type/$post/$sub_pages is my link.
How can I filter this $sub_pages with functions.
If I have to filter it in my post page how can I redirect if $sub_pages does not exists.
sorry for my english.

Read more here: How can I filter variables of query_vars?


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: