get_query_var to get second slash parameters

Question

how i get second parameters affter slash
Example
function.php

function custom_rewrite_tag() {
add_rewrite_tag('%page_name%', '([^&]+)');
}
add_action('init', 'custom_rewrite_tag', 10, 0);

  function custom_rewrite_rule() {
add_rewrite_rule('^page_name/([^/]*)/?','index.php?page_id=60&page_name=$matches[1]','top');
}
  add_action('init', 'custom_rewrite_rule', 10, 0);

example Template page_name www.example.com/page_name/google/yahoo

$get_slug = get_query_var('page_name');
echo $get_slug;
//the reustes only (google) 
// how to get yahoo

how to get word yahoo from url because its dynamc

0
v2mpire 20202 4 months 2020-12-24T14:10:18-05:00 0 Answers 7 views 0

Leave an answer

Browse
Browse