Process all virtual sub pages on parent page

Question

My parent page: http://example.com/id

Virtual pages are:

  • http://example.com/id/1563
  • http://example.com/id/john/5896
  • http://example.com/id/jack-miami/3054

I use shortcode in parent page that gets id number from URL then show the result.

Now all above pages show 404 errors. Is it possible to use the parent page for showing all pages with links containing example.com/id/

I used this but it does not work:

function edit_the_permalink($url){
    if(strpos($url, get_site_url().'/id/') !== false){
        $url = get_site_url().'/id/';
    }
    return $url;
}
add_filter('the_permalink', 'edit_the_permalink');
0
, user2511140 7 years 2016-02-04T03:13:00-05:00 0 Answers 68 views 0

Leave an answer

Browse
Browse