Dynamic content based on a URL parameter

My suggestion would be to use a custom page template. In your functions file you require a php file that contains the custom template. require_once ‘buy_page_template.php’; and that file declares itself to be a template by containing some commented out text: <?php /* Template Name: Buy Page */ Once you’ve uploaded and required that file, … Read more

Added slug after URL permalink last slash returns different content

Those links are called Attachment pages, and WordPress creates one for each media attachment in a post. There are a few plugins to disable them. To redirect the user to the actual post, one can add the following line of code: // in wp-content/themes/[your-child-theme]/image.php <?php wp_redirect(get_permalink($post->post_parent)) ; ?> Link: https://www.greengeeks.ca/tutorials/article/set-wordpress-to-disable-attachment-pages-for-media/