WordPress Development Asked by v2mpire 20202 on February 26, 2021
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
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP