WPSolr logo
  • AI RAG + ChatBot
  • AI Search
  • AI Recommendations
  • AI Personalization
  • AI Pricing
  • More >
  • AI RAG + ChatBot
  • AI Search
  • AI Recommendations
  • AI Personalization
  • AI Pricing
  • More >
  • AI RAG + ChatBot
  • AI Search
  • AI Recommendations
  • AI Personalization
  • AI Pricing
  • More >
Expand All Collapse All
  • Actions and Filters (Hooks)
    • Index - Custom fields
    • Search results - Replace the default WP search by WPSOLR search
    • Index - Sanitize value
    • Search query - Query
    • index - embedded files
    • Search results - Javascript parameters
    • Search results - Default sort
    • Search results - Sort fields
    • Options - Default sort list
    • Options - Solr dynamic field types
    • Options - Custom fields
    • Search query - Fields list
    • Search results - Custom html
    • Search results - Posts
    • Index - SQL statement
    • Index - Document
    • Search results - Replace facets HTML

Actions and Filters (Hooks)

3568 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  11 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
Features
AI ChatBot and RAG
Search
Ajax search
Facets (Filters)
Search Add-ons
Recommendations
MyListing theme search
Flatsome theme search
Keyword search engines
Comparison grid
Apache Solr & Solr Cloud
Opensolr
Elasticsearch
OpenSearch
Algolia
AI search engines
Comparison grid
Weaviate
Vertex AI Search for Retail
Algolia NeuralSearchâ„¢
Vespa.ai
AI recommendation engines
Comparison grid
Vertex AI Search for Retail AI Recommendations
Algolia Recommend
Recombee Recommendations
Amazon Personalize Recommendations
AI personalization engines
Comparison grid
Vertex AI Search for Retail Personalized Search
Algolia Personalized Search
Recombee Reranking
Buy and Learn
Pricing
Affiliates
Why us?
Privacy policy
Built by Eostis
Terms and Conditions
© 2024 Eostis SARL. All Rights Reserved.
More
My licenses
Support
Documentation
Releases
Testimonials
Blog
Recommendations powered for you by WPSolr
Manage Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
View preferences
{title} {title} {title}