-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Consider a situation where a custom taxonomy is used as a permalink structure, but the rewrite rules used by url_to_postid() cause url_to_postid to not find any post ID.
In this situation, when creating a MORI impact via Dashboard > MORI > Add New Impact, pasting the post URL into the editor and saving the Impact saves the URL in the impact post meta, but this fact is not presented to the user.
The reason that the saved URL is not presented to the user is because when the metabox callback https://github.com/Chalkbeat/MORI/blob/master/chalkbeat-MORI/metaboxes/impact-metabox.php#L17-L26 loads the impact metabox template https://github.com/Chalkbeat/MORI/blob/master/chalkbeat-MORI/metaboxes/templates/submit-url.php, the template displays the "empty" view when url_to_postid($url['path']) == 0. This means that the user believes that no impact association has been created, which is probably true (I haven't checked).
Here's a few recommended fixes:
- don't save the URL unless url_to_postid can find a post ID
- display an error to the user if url_to_postid fails
- if you're going to keep the URL saved, display it in that box, but with a warning that the post ID was not found and the impact association was not created