Hot answers tagged urls
I wouldn't call it a bug, you haven't done anything to place that restriction on the query for your post. It also seems like a fairly unlikely case where random strings will end up in place of your taxonomy terms for this to even present itself. Anyway, the answer is to modify the query via pre_get_posts to add in whatever taxonomy data you need. I don't ...
The code you provided could cause issues with 3rd party URLs in hyperlinks not running https. You can fix this by including your home url, e.g: $content = str_replace( set_url_scheme( home_url(), 'http' ), set_url_scheme( home_url(), 'relative' ), $content); Next, you're applying this when you'd like to display the content, which means you need to do an ...
Your post_type_link uses the post's ID, but the item query var expects a postname. To query by ID you need to use the p query var and set post_type: add_rewrite_rule('food/([^/]+)/?$','index.php?post_type=item&p=$matches','top');
Only top voted, non community-wiki answers of a minimum length are eligible