The global $wp_query
object is available before you call have_posts()
. All you have to do is running through this object’s posts
member with get_the_terms()
.
Sample function:
function get_query_terms( $taxonomy = 'post_tag' )
{
$list = array ();
foreach ( $GLOBALS['wp_query']->posts as $id )
{
if ( $terms = get_the_terms( $id, $taxonomy ) )
{
foreach ( $terms as $term )
$list[ $term->term_taxonomy_id ] = $term;
}
}
ksort( $list );
return $list;
}
Be aware any usage of query_posts()
might break this list.
Related Posts:
- how to limit search to post titles?
- How does WordPress search work behind the scenes?
- Remove some pages from search
- WordPress blog with 30 000 posts: poor search performance
- How do I filter the search results order?
- Link to search page without search parameter
- Search/Replace for editor in HTML-mode
- Do I need to sanitize WordPress search query?
- Neither the_excerpt() nor the_content() works properly?
- Add custom parameters to JSON API search query?
- Display posts from an author using search parameters (not author template/query_posts)
- How to stop _wpnonce and _wp_http_referer from appearing in URL
- How do I change WP search results order?
- Include Author profile in search results
- Set minimum number of characters in the search
- search.php template not loading results
- Conditional tag search-no-results
- Search Issue in the theme
- How do I make search results include ONLY pages, no posts?
- Refine Search Results
- pre_get_posts and search query for admin
- I’m trying to expand the scope of the default WP search algorithm. What am I doing wrong?
- Sitelinks Search Box in Google and urlencoded search string
- SQL query to get adjacent posts from search query
- How to specify multiple search columns for wp list table search
- Template Page Content Made Searchable
- WordPress search issue with searching html tags
- Search result by range?
- How to return HTTP 404 when no search results found?
- Change loop.php for empty search customization
- Advanced Search by minimum/maximum values
- How to search in two different wordpress blogs by using a single searchform?
- Alphabetical search
- Search in Two Categories
- Custom Search Query running on every page
- Use search in fancybox
- Two Search Boxes: one all content, one only titles
- WordPress does not find author pages in search
- Keep query string in url after executing a serch
- How can I remove the search window?
- Creating a Search Array From Multiple Tables
- Installing Solr for dedicated search
- Customize search page
- Customise search page depending on result
- How do I use a block to display search results?
- How to make search include data from wp_postmeta?
- How to sort by columns within a search result without displaying all rows again after sorting
- Use “search” in permalink?
- Can I change the default search behavior “OR search” to “AND search”?
- Risk of sql injection for custom search form
- Filter post_type thumbnail in Search result
- Home page shows recent post, serps rank post within homepage
- How to set empty search to load homepage template and not index.php
- custom search results affected by _REQUEST set
- How to implement search suggestions into search bar?
- Modifying post content with the_post action hook
- Trying to remove plural ‘s’ from search Query but it’s just removing every letter of the end – what am I doing wrong? Thanks
- Blog search just returns to front page (not search results!)
- How to insert meta keyword to search result page
- Intelligent Search Filtering
- Custom search Dashboard widget
- How to search titles/artist/album within a playlist, and only lists the results that match?
- Disable character’s replace in search
- WordPress Search Form Issue | Misleading search URL. | Pointing to wrong URL
- Echoing home_url() returns current url in searchform.php
- Remove Page Timestamp via functions.php so it doesn’t show in Google Search Result Description [closed]
- Use pre_get_posts to display search results by meta in specific order
- Prevent search query from taking place when using Google CSE?
- Site Title in my Search URL
- I want empty search returns to home page in my wordpress
- Prevent searches less than 4 characters
- Search wordpress using three different drop down menus
- How to get search result as image rather than page
- Search results – 404 error after hitting enter
- Redirect wordpress search query if its a tag
- Is it possible to show subdomain posts in main domain search result?
- Replacing word in wordpress Search not working Properly
- How to add search box to table results in admin page [closed]
- How might I go about using the API to search for a user by email, but ensuring that it is an exact match?
- Add CPT to search results with pre_get_posts
- Some search results link to main page instead of post
- Replacing wordpress search with custom code
- Change output URL Search module
- search for single meta_key with numeric array of meta values
- How to customize default wordpress search query
- Customizing Google’s Search box in WordPress [closed]
- I’ve messed up the admin search functionality. Help!
- Content instead Excerpt on term
- Custom search results page not showing excerpt
- Error when searching without any results
- Listing parent section in search results
- Search results: How to add direct jump to anchor?
- Limit search to posts and pages
- How make Autocomplete with wp_query in post_type attachment
- Search results truncated
- “feed” added at the end of my URLs
- Disable – Post search field – for non-admin roles in WP dashboard
- Search results heading and counter not working – Oxygen Builder
- How to quickly search posts by title in Admin interface
- Blocking spambots from Search form