I found a partial solution that allows you to recognize and save a permalink when loading a page in the address bar, but not update on the editing screen or other links to a message on the site. Add the following functions to the functions.php file or plugin with a specific site, replacing example-post-type with the identifier of your message type.
function example_rewrite() { add_rewrite_rule('^example-post-type/([0-9]{4})/([0-9]{1,2})/([^/]*)/?','index.php?post_type=example-post-type&year=$matches[1]&monthnum=$matches[2]&name=$matches[3]','top'); } add_action('init', 'example_rewrite');
This uses the Rewrite API registered here. For more tips on understanding the process, see here .
One thing to keep in mind, no matter how you do it, it is impossible for two posts to have the same slime, even if they have different dates. This is because if the permalink always changes, they may collide and cause errors.
Caelen feller
source share