A simple way to do is to edit your theme’s “search.php” (copying it from the parent theme into your child theme’s directory first if you’re using a child theme) and then before the posts loop putting something like:
<?php
if ( $tag = get_term_by( 'name', get_search_query(), 'post_tag' ) ) {
?>
<article><!-- or whatever is consistent with rest of listing. -->
<h2 class="entry-title"><!-- ditto -->
<a href="https://wordpress.stackexchange.com/questions/174104/<?php echo esc_url( get_tag_link( $tag->term_id ) ); ?>" rel="bookmark"><?php printf( __( '%s (tag archive)' ), $tag->name ); ?></a>
</h2>
</article>
<?php
}
?>
Related Posts:
- Tag Posts showing in wrong places
- What is the link to my default “archive” page?
- How to create tag.php
- Restrict a search to a custom post type
- Post formats template
- Same template for all the terms of a taxonomy
- Modifying searchform.php and search.php to have two kinds of searches
- Unable to create custom search results template page
- get_search_link() redirects to 404 template page
- Search results when none found – stay on page they were on
- Get link to a specific template file [closed]
- Redirect template based on permalink rather than $wp_query
- Standard WordPress Search does not work / Search-results are not displayed / Custom template
- How to identify which template WordPress’s default search-form retrieves in my theme
- How do I override the search template in a plugin?
- Use one template only for custom post type archives?
- What is the best practice to style archive page 2,3,etc differently than archive.php?
- How to use index.php as a template for archives?
- Archive template limiting to 4 entries?
- Force WordPress to NOT display the manual excerpt
- How to get and set the post tag value within WP Query from URL?
- Conditional to determine if search.php page is the current template
- How can I get all archive-URLs to use the same template?
- Pagination issue with tag.php
- How to use another file instead of home.php
- use a custom page to display search results
- Displaying a list of tags in my archives page
- which template does wp_ tag_ cloud point to?
- How do I get tags linking to proper pages (/tag/sample-tag -> pages with that tag)
- How to name custom search page PHP file?
- Search button click sends to single-custom_post_type instead staying at the same page
- Archive only for /year/month, not terms
- how to change custom post type search template to output search results in posttype-archive.php
- Custom Post Type tag taxonomy “Page Not Found”
- Editing the tag pages and using templates
- Where is search.php?
- Search results in custom template
- Problem with permalink structure for WordPress custom post_type archive template
- How do I get the size of an attachment file?
- How to get slug of current category in taxonomy template?
- Using WordPress templating for HTML emails
- I put my blog on a subpage, how do I get page title?
- Test if page is child and has children, if so echo child pages also on grandchild pages
- Correct process for a new Page Template?
- Templates & CSS – Proper Programming Practice?
- A shared custom taxonomy between two custom post types
- New Template — copy existing template and change code? [duplicate]
- Create a WordPress template without navigation and footer
- Template redirect is_tax() not working
- Hide Front-End Admin Bar Including 32 px Spacing
- Change directory where get_header(), get_footer() and get_sidebar() look for templates
- How to format shortcode’s HTML in external file
- Turning on the 404 page on localhost
- How to add additional search terms (e.g. synonyms) to the search?
- Checking for page templates in child theme
- Is there an action hook that fires just before a template is loaded?
- What’s the equivalent of front-page.php for a custom static page?
- Valid HTML in Template Part
- Why do I get the same excerpt for all items in my RSS feed?
- What is this code trying to do? It was the cause of my 20s TTFB
- Problem when linking out to separate file within foreach loop
- Search Posts / Pages with multiple options?
- Conditional tags or Multiple files
- Getting term description in single post template
- Cannot edit style.css from admin panel, because the template is looking for style.min.css
- Remove post templates from the selection box menu when creating a single post
- global variables in templates
- Real Time Page Template Preview in WP Admin [closed]
- Best practice to update the file header.php
- page-{slug}.php vs. template-{slug}.php
- Understanding the Template hierarchy
- Can I have both front-page.php and index.php?
- /tag/tag_name/page/2 gives a 404 error
- get_header(), get_footer() from plugin template
- If Posted After Date
- Function filter breaking tag archive menus
- How to make tags show up in search results?
- Update template without undoing all my edits?
- Image loading function not working on archive.php template
- The wordpress website is showing ‘w’ while it loads and in the footer
- Assign Specific Template for Custom Post slug
- Make archive page show up in search results?
- Using if statement in index.php instead of creating separate template files
- Displaying year once in category.php [duplicate]
- Why won’t the action hook wp_head accept parameters?
- the_post() in RSS feed
- Editing my loop-page.php causes posts to show on all pages
- How can i conditionally load taxonomy-{taxonomy}.php template php files through functions.php
- WordPress site not loading styles on desktop?
- ACF – Attach JS file depending on ACF field
- Which template(s) to override to use a different sidebar for blog, single posts, categories, blog archive?
- How can I modify this code to include the parent?
- Locating the template behind a WordPress Page
- us states dropdown function and echo in theme template files
- Current URL path variable
- Why is my no-results.php template moving my sidebar and footer into the main container?
- Can you orderby slug in a taxonomy archive page using WP_Query?
- Change the text “search result for” on search result page
- Search with multiple selects that include tags
- templates page not showing on gutenberg editor