
All Post Type Ajax Search
v1.1.0Daniel Esparza · 2025年9月16日 上架
Real-time AJAX search. Choose in the admin which post types appear in the results. Shortcode: [all-post-type-ajax-search]
- 正在使用
- 10 以下
- 评分
- 暂无
- 累计下载
- 653
- 最近更新
- 2026年11月5日
需要 WordPress 5.0+已测试到 7.1.5PHP 7.2+
贡献者
截图
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
- Simple shortcode: [all-post-type-ajax-search].
- Admin settings: choose the enabled post types and set a default image (URL).
- Each result shows a thumbnail (or the default image), the title and a link.
- Results are spread across post types so posts or pages are not always shown first.
- Default limit of 5 results; searching starts at 3 characters.
- Performance: no_found_rows in queries, limited posts per query, and CSS/JS loaded only on pages that contain the shortcode.
- 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).





