php - How to add a custom ID to a Wordpress page with pagination? -
i have wordpress page. when add custom id url, unwanted 'paged' page.
i want overview of custom data api. when click on item, should redirected '/mypage/10'. build plugin shortcodes, retrieves data api , displays it.
then want want check if page 'mypage' has id in url. if so, retrieves new data , shows it.
looked across internet, can't find want.
validate id through parameters using
'mypage?id=10'
and check @ api side for:
$_get['id']
that should avoid routing issues or having rewrite routes. make sure escape variables properly.
update seo purpose
as of taken directly wordpress, add custom route rule application, using following:
function custom_rewrite_basic() { add_rewrite_rule('^mypage/([0-9]+)/?', 'index.php?page_id=$matches[1]', 'top'); } add_action('init', 'custom_rewrite_basic');
just edit 'index.php?page_id=$matches[1]', match own destination.
Comments
Post a Comment