All Post Type Ajax Search
All Post Type Ajax Search

All Post Type Ajax Search

0/5 (0 ratings) — active installs Updated Nov 5, 2026
Settings: choose the post types and the default image.

Settings: choose the post types and the default image.

All Post Type Ajax Search adds a lightweight, secure search box that returns results in real time (AJAX). From the settings screen you choose exactly which content types (posts, pages, products and other custom post types) are included in the search. Each result shows a thumbnail (or a default image), the title and a link.

Main advantages:

  • Fast front-end search with up to 5 results and a minimum of 3 characters.
  • Full control from the admin: choose the post types that appear in the results.
  • Smart filtering that hides technical types (attachments, revisions, orders, variations, etc.).
  • Built following WordPress security best practices: nonces, sanitization and escaping.
  • Simple procedural code, easy to customize for developers of any level.
  • Translation ready (text domain: all-post-type-ajax-search).

Features

  1. Simple shortcode: [all-post-type-ajax-search].
  2. Admin settings: choose the enabled post types and set a default image (URL).
  3. Each result shows a thumbnail (or the default image), the title and a link.
  4. Results are spread across post types so posts or pages are not always shown first.
  5. Default limit of 5 results; searching starts at 3 characters.
  6. Performance: no_found_rows in queries, limited posts per query, and CSS/JS loaded only on pages that contain the shortcode.
  7. Security: nonces for AJAX and settings; capability checks (manage_options) in the admin.

Video

Additional Notes for Developers

  • Stored options:
    • aptas_search_post_types (array): enabled post types.
    • aptas_default_image_url (string): default image URL.
  • Nonces:
    • AJAX: aptas_search_nonce
    • Admin: aptas_settings_save (field name aptas_settings_nonce)
  • Shortcode: [all-post-type-ajax-search]
  • AJAX action: aptas_ajax_search (wp_ajax_aptas_ajax_search / wp_ajax_nopriv_aptas_ajax_search).