문제

I need to add a custom parameter/segment to the post URL.

For example, when I have a post at example.com/post-name, I need to add another segment like example.com/post-name/places. After that, I need to add a dynamic segment like example.com/post-name/places/dynamic-value.

I can't use ?key=value parameters, it needs to be segmented. I've tried to work with add_rewrite_rule(), but it doesn't seem to work.

How can I achieve something like that?

도움이 되었습니까?

해결책

Have you thought of making post type, taxonomy, terms?

If you do so, it will be a lot easier for you to code and get the above urls.

If any confusion, let me know.

다른 팁

I actualy managed to do that with add_rewrite_rule(); just before add_rewrite_rule() you need to use flush_rewrite_rules() function, and it works.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 wordpress.stackexchange
scroll top