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/
Related Posts:
- Which method is best to enqueue scripts
- Preserve custom URL parameter on more pages
- Change the path where wordpress plugins are uploaded
- How to make WordPress use protocol indepentent upload files?
- How to call plugin path in JS?
- Absolute Path (ABSPATH) in WordPress is not working
- Woocommerce different URL for every table placed in the restaurant
- Author Specific URL’s in WordPress
- While Using Static Pages, How Can I Get /blog into the URL of Each Post?
- Migrating a File from Plugin to Theme and changing its path → instead create a REST endpoint
- Add query string to plugin URL
- I need to generate the CSS for my plugin from a function, how do i map a request to a function in the front-end?
- Is revealing just the AUTH_KEY a security issue?
- Get uploaded image url
- How can I pass a variable to a page with a SEF url?
- locate_template with multiple categories?
- custom taxonomy and custom post type url conflict
- WP Paths in a Plugin – how to include
- Find the URL of the current plugin directory
- plugins_url function mixes system path and URL
- Custom page slug without creating a WP page
- Best way to hook a custom url?
- Changed permalink structure. Need help with redirecting old posts
- What is an arbitrary URL?
- How can I change a plugin’s URL?
- How to make a proper custom post type link
- Why WordPress plugin url ajax doesn’t work?
- Retrieving a path when dealing with composer packages
- Is there a hook to Intercept al urls from a webpage and redirect to a page
- WordPress shows error related to allow_url_fopen
- Ability to automatically redirect a URL
- Subdomains with almost the same content
- URL parameters causing 404 on home page, but nowhere else
- Using arbitrary paths in page urls
- change content based on url per plugin
- Redirect to another page using contact form 7? [closed]
- How to get path or root of plugin folder, not file or dir?
- Slashes stripped in ACF
- correctness of URL
- Correct Plugin File Path
- Hardcoded paths in my plugin
- How do I convert my WordPress website to be domain agnostic?
- Need to change link URL embedded in multiple posts to new link URL
- How to pass a query string to another page on the same site?
- how to replace hostnames on certain external links?
- How to rewrite URL and get the values?
- Scrape a webpage for image and add it to post
- Change url of posts with keywords
- How to access the WordPress DB from a plugin file
- Absolute paths in backend for plugins after moving wordpress
- Replace video url with video player
- Replace image urls(absolute instead of relative) by using filter in single page
- Offer Download Links for Product Images
- How to hide particular plain text with link from different subscribers
- Redirect unloggedin users
- Change language on website and change currency with url query
- Add a parameter at the end of the url and prettify
- insert og image link in wordpress post
- How to create a folder in wordpress that will contain pages?
- How to generate expiring URL of the page?
- Include my files in a plugin? [duplicate]
- how to include my homepage and scc in to a plugin
- Failed GET Request From admin.php To Fetch .min.js File From Unminifed Directory
- path of wp-content directory when we are on some plugin
- How to allow URL with filename & extension in wordpress?
- Having multiple URL structure for wordpress blog
- Some resources of my website are pointing to www.mysite.com/dev/ and trying to get rid of that append has been a headache
- How do you remove question mark in URL in get method?
- WordPress drop domain alias
- URL Case Sensitivity (Unbounce Landing Pages)
- Automatic set a featured image from the first image’s url (or tag) in the article
- Get not the full path
- WordPress website giving 404
- Infinite 301 redirects after definitions in “Redirections” plugin?
- Unexpected plugin_dir_path Output
- Keeping original URL
- How to link file or image from wordpress plugin dir to theme by using themes function.php, is it possible?
- Using permalinks with parameters
- Images not showing on homepage after migration [duplicate]
- Creating custom URL for async content
- URL RewriteRule doesn’t work when using WP Database Participants in my WordPress website
- How To Rewrite WordPress Pages URL Only?
- How to tell if a script is being executed from a plugin, a theme or a child theme in WordPress?
- Server Path Information
- How can I process all requests for a given directory in a URL with my plugin?
- Unwanted Links and Spam WordPress Pages and Posts
- Display Plugin information on specific url
- Why links are not linked if edited comment?
- Include paths and functions for external scripts
- Register additional wp plugin directory
- How to get the real address from a url (permalink)
- Remove base from the custom post type URL [duplicate]
- WP Job Manger change jobs url (NOT slug)
- map urls to plugins
- HTML link within my plugin settings page
- Why plugin’s icon for the menu not found?
- Fetching Video From YouTube Automatically [closed]
- How to create a custom wordpress plugin for a specific functionality?
- WP-DBManager Plugin Can’t Find Mysql Path
- How to change all the urls of the WordPress site?