Search: AI, Hybrid, Classic

  • Pricing
  • Help
    • My Licenses
      • Login
      • Download
      • Why us
      • Contact us
    • Features
      • Google Retail Search
      • Weaviate
      • Elasticsearch
      • OpenSearch
      • Solr
      • Algolia
      • Roadmap
      • Artificial Intelligence
      • Hosting
      • Releases
    • Documentation
    • Support
    • Testimonials
    • Live Demos
    • Blog
Menu
  • Pricing
  • Help
    • My Licenses
      • Login
      • Download
      • Why us
      • Contact us
    • Features
      • Google Retail Search
      • Weaviate
      • Elasticsearch
      • OpenSearch
      • Solr
      • Algolia
      • Roadmap
      • Artificial Intelligence
      • Hosting
      • Releases
    • Documentation
    • Support
    • Testimonials
    • Live Demos
    • Blog
Search
Search
Search
Search

Home » Actions and Filters (Hooks)

Actions and Filters (Hooks)

3215 views 1 October 11, 2016 Updated on November 14, 2020

This guide is all about the WordPress actions and WordPress filters (also name hooks) available in the plugin.

Each action or filter is detailed in its own document, with:

  • Name
  • Schematic
  • Parameters
  • Description
  • php code to call it
  • php code to catch it
  • php code to use it

General

All actions and filters are defined as constants, in the class WpSolrFilters, in the file /wpsolr-search -engine/classes/wpsolr-filters.php.
We recommend that you use the constant, rather than it’s string value.

For instance, in your php code, use

 
use wpsolr\core\classes\WPSOLR_Events;
WPSOLR_Events::WPSOLR_FILTER_POST_CUSTOM_FIELDS

rather than

'wpsolr_filter_post_custom_fields'

 

Your declaration of the hook containing a reference to the php class WPSOLR_Events, it must be executed after the WPSOLR plugin is loaded.

For instance, in:


use wpsolr\core\classes\WPSOLR_Events;

if ( defined( 'WPSOLR_PLUGIN_SHORT_NAME' ) ) {
add_action( 'after_setup_theme', function () {
... declare your WPSOLR actions or filters here
} );
}

or in


use wpsolr\core\classes\WPSOLR_Events;

if ( defined( 'WPSOLR_PLUGIN_SHORT_NAME' ) ) {
add_action( 'admin_init', function () {
... declare your WPSOLR actions or filters here
} );
}

Was this helpful?

1 Yes  10 No
Related Articles
  • Video – WPSOLR PRO + ACF PRO + Choice Types + TwentySixteen + Elasticsearch
  • Search results – Replace facets HTML
  • Search results – Replace the default WP search by WPSOLR search
  • Index – Sanitize value
  • Search query – Query
  • index – embedded files

Didn't find your answer? Contact Us

Up Next
Index – Custom fields
Expand All Collapse All
  • Actions and Filters (Hooks)
    • Index - Custom fields
    • Index - Document
    • Search results - Replace facets HTML
    • Index - SQL statement
    • Search results - Posts
    • Search results - Custom html
    • Search query - Fields list
    • Options - Custom fields
    • Options - Solr dynamic field types
    • Options - Default sort list
    • Search results - Sort fields
    • Search results - Replace the default WP search by WPSOLR search
    • Search results - Default sort
    • Search results - Javascript parameters
    • index - embedded files
    • Search query - Query
    • Index - Sanitize value
Login
Support
Privacy policy
  • Terms and Conditions
  • © 2020 wpsolr.com. All Rights Reserved.
Youtube
Roadmap