Let’s what can be done. Try the bellow code. First I’m checking if it’s search query. Then trying to get the count from global query.
function search_count(){
if(is_search()){
global $wp_query;
$not_singular = $wp_query->found_posts > 1 ? 'results' : 'result';
echo $wp_query->found_posts . " $not_singular found";
}
}
Related Posts:
- How do I improve this admin query snippet to avoid generating duplicate results on non-meta searches?
- How to make dynamically-generated content searchable in WordPress?
- Displaying search results in the widget itself?
- modify wordpress default search
- what are the checksums surrounding keywords in the SQL generated by WP_Query and do I need to use them too?
- Search the product by tag or category not working
- Search and Filter
- Using ob_get_content to get_search_form puts into infinite loop
- How can I replace the search results displayed by WordPress?
- Showing results from json-string in WordPress search results page
- Ajax action has 200 status but response of No response data available for this request
- ajax stopped working when not logged in wordpress
- Generate Static Page to Show Search Results/Detail for API
- Modify search form with plugin
- WP Query Relations / Compare
- WordPress Search Form with Keyword Suggestion
- Simple Search Plugin Does Not Perform Search
- How to search on the field that stores escaped strings?
- Change the search results header from plugin
- How to create a custom search form and handler?
- Get custom wp_query search results to appear on search.php
- Why is WordPress wrapping search for users that looks like integers with asterisks and how do I fix it?
- Hook a search form anywhere on the site, using a custom plugin
- Default table collation on plugin activation?
- How to implement color picker from wordpress in my plugin?
- Nonces can be reused multiple times? Bug / Security issue?
- the_content after all shortcodes are parsed
- How to auto-upgrade my plugin?
- How do I resolve Notice: Undefined offset: 0 in /wp-includes/capabilities.php on line 1145
- Category listing with thumbnail and description on home page
- How to Add a .js file Only in one specific Page Dynamically to Head
- URLs of plugin resources?
- anything like add_meta_box for categories?
- Missing “category_children” option when dynamically creating categories via a plugin
- Developing a plug-in to charge for
- WordPress: After Gutenberg plugin migration to block.json the localization/ translations with PolyGlot in JavaScript does not work anymore
- What is the Difference between directly call a function and call a function using add_action?
- What is better way to use Bootstrap inside admin panel?
- Updating my plugin without releasing a new version
- 404 errors after plugin options update and category base change
- How to determine, from plugin script, if active theme has The Post Title
- Widget Admin – Form Submit Event?
- add_filter : Passing an array instead of the callback function?
- Advice on plugin structure
- Using wp_parse_args to set up Plugin Default Settings
- how to add Jquery script to one page?
- how do you prevent showing a particular category on the admin dashboard for specific user roles?
- Problem with parameters in url and pagination
- get_posts() not working when accessing with a custom user role
- Where can i find wordpress auto update code flows?
- Are there any scripts, classes, and/or functions built-in to WP for a plugin to export/import its saved data from wp_options?
- Do I have to worry about useState causing a re-render?
- How to fetch only current hour posts?
- Plugin sub-menu pages recommended structure and links
- template_redirect or admin-ajax.php?
- mysql_real_escape_string() vs. esc_sql() in WordPress
- Widget HTML Display Problem
- Display list of uploaded images, filtered by user under a specific user group
- Bug: Post needs to be updated twice when adding action for save_post hook
- my own SVN for a plugin/theme
- How to enqueue scripts in right way in a plugin?
- Activate theme via plugin script?
- How can I add function calls to my plugin’s options.php default submit routine?
- Secruity Questions on a timer
- How to rename the plugin PHP file without affecting existent users?
- Add location tag to wordpress posts
- Open tab on current day problem jQuery and WordPress
- Plugin working on my local installation but Cannot be activated online
- Is there a WordPress plugin to design WebGL? [closed]
- WordPress Page Reload Takes forever during theme development
- How to add some basic inline CSS using existing plugin or theme?
- Font size of HTML content
- How to highlight a page in the page list (Admin Menu)?
- How do I add filter with woocommerce categories?
- Where do I hook to have the server do something in PHP on block attribute change?
- Some difficulties in implementing markdown editor
- Hook for validating and rejecting frontend image upload
- Overriding the template files using a plugin for all themes
- Plugin removes itself if mistake made during edit
- Using meta_key & meta_value in add_rewrite_rule
- Can’t create a blank template
- Custom Registration Form and Passwords
- Determine if the current page, is being edited
- Looping single post in a theme
- WP Ajax on page load not working on bluehost but was working on Godaddy
- Fullwidth slider using background image Flexslider WordPress
- Return value of $wpdb->update() query in plugin is wrong
- Is there a way to tell if a shorcode’s handler is being run before or after the content formatting filter?
- Plugin files not updated (cache cleared)
- How to limit the number of posts a user can view based on status
- How to create an embedded code for wordpress shortcode?
- How can I send an id over the url?
- Get fields of a widget
- How to add additional field in a table row after creating a table?
- WordPress plugin tables become corrupt
- How to call a new php page inside a plugin page?
- How can i call from custom fields to the category editor?
- How do you filter get_media_items by mime type in a custom media upload tab?
- Is it possible to convert various image types from remote URLs to WebP and then serve them immediately?
- If I want to create new taxonomies (e.g. Project / Documents / Etc…) is it better to create them in the theme’s functions.php or within a plugin? [duplicate]