Custom Rewrite RUle PAGE Wordpress

Custom Rewrite RUle PAGE Wordpress

register and hook

function listen_rewrite_action() {
  add_rewrite_tag('%show%','([^/]*)');
  add_rewrite_rule(
    '^listen/([^/]+)$',
    'index.php?pagename=listen&show=$matches[1]',
    'top');
  add_rewrite_rule(
    '^listen/([^/]+)/page/([^/]+)$',
    'index.php?pagename=listen&show=$matches[1]&paged=$matches[2]',
    'top');
}
add_action( 'init', 'listen_rewrite_action' );

get data

get_query_var( 'listen' );

source: _https://wordpress.stackexchange.com/questions/206819/rewrite-rule-for-custom-page-with-query-vars-in-url

Tags: