If you place the code below in single.php file anywhere you want the links to appear in your posts, or inside a function in functions.php and the function tied to a filter or an action like ‘the_content’, the you shold get a list of links to the posts that have the same tag or tags as the post you are currently reading.
global $post;
$this_post_tags_ids = wp_get_post_tags( $post->ID, array( 'fields' => 'ids' ) );
$query = new WP_Query( array('post_type' => 'post', 'posts_per_page' => -1, 'tag__in' => $this_post_tag_ids ) );
if ($query->have_posts()){
while($query->have_posts()){
$query->the_post();
echo the_title('<h3><a href="'.get_the_permalink.'"/>', '</a></h3>');
}
}
wp_reset_query();
I didn’t tested it, but it should work.
Related Posts:
- Internal Links to Pages in PHP?
- How to display page title+link of page created by user
- How to create wordpress page that shows posts with specific tags?
- How to exclude shortcode from specific page IDs if it’s set to global
- How to get the excerpt of a page before more tag?
- Add a Menu Link (to a WordPress Page) in the Admin Menu/Sidebar
- Why doesnt ONE of my links in the footer work properly? [closed]
- Relative instead of absolute links in pages?
- Related Links Page with moderated, user suggested link submissions
- How to make tag post listing page working?
- I can’t edit my homepage – the page editor is just blank [closed]
- How to get tagged pages to show up with tagged posts?
- Query pages based on tags
- Get all children titles of a page as a link to them
- anchor tag in header not working on other pages except the home page
- trying to add a author value in wp page links?
- Hide links to pages that dont have any content
- How do you run code on a specific page without missing the init hook?
- Add pagination to search.php page
- Access link page and not folder content of that link
- Search Page: activate html code if the tag is on the page
- How to achieve anchor links on top of pages.
- Tags are automatically converted if they match post names. Stop It!
- one time visit to the page
- Display list of posts with x tag within a page?
- Add tags to long page that is broken up into subpages?
- How to get a list of pages (not posts) with specific tags?
- Add infinite scroll to content splitted post
- Check if wp-login is current page
- How to get current page ID outside the loop?
- Contact Form on WordPress Sites?
- Page returns 404 with POST variables, but not without
- Custom templates not showing up in template dropdown
- Get page id by template
- Using pre_get_posts on true pages and static front pages
- Get the content of a specific page (by ID)
- How to get page title with the page ID?
- Show more than 20 items in pages or posts edit dashboard
- Allowing user to edit only certain pages
- How to display last 3 posts (recent posts) in a static page?
- How to give paged links custom title?
- How to set post slug when using wp_insert_post();?
- How can I keep the content of my pages version controlled?
- How to load javascript on custom page template?
- How to configure WordPress to handle 75,000 pages?
- How to update page status from publish to draft and draft to publish
- Check if is on child-page of a particular page
- Change page template programmatically ?
- Conditional tag to check if ‘page.php’ is being used?
- Customizing the URLs of WordPress Login and Sign-up Pages?
- How to disable posts and use pages only
- featured image as background image on pages
- Check IF is a “single product page” and Check the “role” for a Redirect
- A check for if is parent page, if has children, if has grandchildren
- On the WordPress Admin section how do I link to submenu pages created for a plugin?
- How to load JS and CSS only on specific Pages using is_page()?
- Listing pages which uses specific template [duplicate]
- Proper way to get page content
- Access the same page from multiple urls (wildcard)
- Create a page without adding a page in the Database
- Is there a way to change the default page template selection?
- Can I have two child pages of different parents with the same name?
- What methods to use to create small, editable pieces of text for static pages?
- Show Default Editor on Blog Page ( Administration Panel )
- Hide page visual editor if certain template is selected?
- What is the difference between $paged and $page?
- multi page password protection
- Create a “Dummy” parent page for a hierarchy in page listing?
- How do I convert a page’s title to lower case?
- Get top level page parent title
- How to add a specific widget to only 1 page?
- Restrict admin access to certain pages for certain users
- page title, parent tilte and grand parent title
- How to Get Next or Previous Post in a Specific Tag?
- How can I store page ID in a post instead of other selected permalink?
- How to add jQuery script to an individual page?
- WordPress page edit does not save selected template
- Add a Page without header and menus?
- What is an alternative to get_page_by_title()?
- Password protect page with multiple passwords
- Create pages automatically if they don’t exist
- Find empty pages or pages which have less than x characters
- Allow only new sub-pages to be created
- Set page template automatically based on parent
- Editing Complex Pages in Visual Mode
- Link section within page with slash (/) and not hash (#) without reloading the page
- Creating a template using a specific slug name, for a page with a parent page
- Can I display submenus in groups, using wp_list_pages?
- Is there a default template file for child pages / subpages?
- Get wp_get_attachment_url outside of loop
- Order by menu_order and title?
- Require title for pages
- WP Page and Subdirectory with same name
- Replace Dashes Before Title in Page List
- Add a new page to wordpress programmatically
- Get Permalink for the top level parent of child pages
- Proper method to restrict non logged users into certain pages
- How to redirect on particular page in wordpress? [closed]
- Get page id by title?
- What is the use of $page_title and how to use it?