Custom page for editing custom post type on frontend based on url

You can add custom url structures with add_rewrite_rule for example the proposed structure in your question can be achieved with something like… add_action( ‘init’, function() { add_rewrite_rule( ‘^jobs/([^/]+)/edit/?$’, ‘index.php?post_type=jobs&name=$matches[1]’, ‘top’ ); } ); So now if you visited https://example.com/jobs/job-title-example/edit/ you should see exactly the same as if you were to visit https://example.com/jobs/job-title-example/ this is because … Read more

Custom Post type collection

Do you have has_archive set to true in you register_post_type function? If so, you can use archive-shoes.php as your archive template. For more information about registering custom post types, please check https://developer.wordpress.org/reference/functions/register_post_type/ EDIT To load a custom archive template (without having to use the default WP template naming conventions), you can use the archive_template hook … Read more

Before saving post hook

Yep, it looks like there is no option how to stop post saving. I am checking wp-includes/post.php, and all I see is wp_insert_post_data filter where you can check and modify post data (before saving), but that’s all. Or … you can hook to save_post, and if there is something wrong with the post, then call … Read more

wp_get_canonical_url showing first url of the post for custom page

This is because wp_get_canonical_url can only be used on posts, and cannot be used for tags authors archives etc. Returns the canonical URL for a post. https://developer.wordpress.org/reference/functions/wp_get_canonical_url/ More specifically, no equivalent exists for tag archives because archives and listings do not have canonical URLs. A canonical URL indicates to a search engine the correct and … Read more