WPSOLR - Actions and Filters (Hooks)

Actions and Filters (Hooks)

1903 views October 11, 2016 January 18, 2017 admin 1

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 it’s 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

WpSolrFilters::WPSOLR_FILTER_POST_CUSTOM_FIELDS

rather than

'wpsolr_filter_post_custom_fields'

 

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

For instance, in a:
add_action( 'after_setup_theme', function () {
... declare your WPSOLR actions or filters here
} );

or in a
add_action( 'admin_init', function () {
... declare your WPSOLR actions or filters here
} );

Was this helpful?