Our Wordpress website has a custom post type named "life".
For each "life" post , A specific custom field value "special" (true | false) is set.
I want to rewrite the URL only if the custom field value "special" is "true" so that I can easily filter only those posts with special=true in Google Analytics.
I don't want to change the post type itself.
I also considered adding the taxonomy name to the URL, but this affetcs other posts.
I don't want to change the URL of posts where the "special" value is NULL or false.
I am thinking about changing the permalink structure with a hook or something , or forcing parameters to be attached to the URL.
- URL examples I want to realize (
life-articleis slug name and "special" field is true)
- If the post's "special" value is false or NULL , URL should be
- Custom post type is set with the following plugin:
- Permalink setting screen
- The post type is set by the following plugin:
- I tried the following hooks, but it didn't work because I guess it wasn't compatible with the Custom Post Type Permalinks plugin.
- The "life" posts have
%postname%in the permalink. Is it possible to rewrite this to a URL like
- Since the Custom Post Type UI plugin is used to add the post type, I would appreciate it if you could tell me how to do it without using
register_post_type()function. Or is it possible to overwrite the value set in