Capturing arbitrary semantic URL arguments
-
I’m using ACF to store some extra data for my posts.
I don’t want to show all of that data when user visits certain post, e.g.
mysite.com/{category-name}/{post-name}/
What would be ideal is to have this kind of url :
mysite.com/{category-name}/{post-name}/detalis/{field-name}
And than I would have
$details
variable with content offield-name
url part available in my post template with which I could show or hide some data.I’ve tried something like this so far in my
functions.php
file :function add_details_endpoint() { add_rewrite_endpoint('details', EP_PERMALINK); } add_action('init', 'add_details_endpoint');
but when I visit :
https://localhost/uncategorized/my-post/details/stuff
I get 404 error.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Capturing arbitrary semantic URL arguments’ is closed to new replies.