Version Description
- New feature: New action hooks
relevanssi_pre_the_contentandrelevanssi_post_the_contentfire before and after Relevanssi appliesthe_contentfilter to the post excerpts. Some Relevanssi default behaviour has been moved to these hooks so it can be modified. - Changed behaviour: The
relevanssi_do_not_indexgets the post object as a third parameter. - Minor fix: Remove errors from
relevanssi_strip_all_tags()getting anullparameter.
Download this release
Release Info
| Developer | msaari |
| Plugin | |
| Version | 4.12.4 |
| Comparing to | |
| See all releases | |
Code changes from version 4.12.3 to 4.12.4
- lib/excerpts-highlights.php +36 -11
- lib/indexing.php +2 -1
- lib/init.php +5 -0
- lib/utils.php +4 -1
- readme.txt +9 -1
- relevanssi.php +2 -2
lib/excerpts-highlights.php
CHANGED
|
@@ -110,21 +110,18 @@ function relevanssi_do_excerpt( $t_post, $query, $excerpt_length = null, $excerp
|
|
| 110 |
$content .= relevanssi_get_custom_field_content( $post->ID );
|
| 111 |
}
|
| 112 |
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
// don't want that.
|
| 118 |
-
remove_filter( 'the_content', 'prepend_attachment' );
|
| 119 |
-
|
| 120 |
-
remove_shortcode( 'noindex' );
|
| 121 |
-
add_shortcode( 'noindex', 'relevanssi_noindex_shortcode_indexing' );
|
| 122 |
|
| 123 |
/** This filter is documented in wp-includes/post-template.php */
|
| 124 |
$content = apply_filters( 'the_content', $content );
|
| 125 |
|
| 126 |
-
|
| 127 |
-
|
|
|
|
|
|
|
| 128 |
|
| 129 |
/**
|
| 130 |
* Filters the post content after 'the_content'.
|
|
@@ -1404,3 +1401,31 @@ function relevanssi_kill_autoembed() {
|
|
| 1404 |
}
|
| 1405 |
}
|
| 1406 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
$content .= relevanssi_get_custom_field_content( $post->ID );
|
| 111 |
}
|
| 112 |
|
| 113 |
+
/**
|
| 114 |
+
* Runs before Relevanssi excerpt building applies `the_content`.
|
| 115 |
+
*/
|
| 116 |
+
do_action( 'relevanssi_pre_the_content' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
/** This filter is documented in wp-includes/post-template.php */
|
| 119 |
$content = apply_filters( 'the_content', $content );
|
| 120 |
|
| 121 |
+
/**
|
| 122 |
+
* Runs after Relevanssi excerpt building applies `the_content`.
|
| 123 |
+
*/
|
| 124 |
+
do_action( 'relevanssi_post_the_content' );
|
| 125 |
|
| 126 |
/**
|
| 127 |
* Filters the post content after 'the_content'.
|
| 1401 |
}
|
| 1402 |
}
|
| 1403 |
}
|
| 1404 |
+
|
| 1405 |
+
/**
|
| 1406 |
+
* Adjusts things before `the_content` is applied in excerpt-building.
|
| 1407 |
+
*
|
| 1408 |
+
* Removes the `prepend_attachment` filter hook and enables the `noindex`
|
| 1409 |
+
* shortcode.
|
| 1410 |
+
*/
|
| 1411 |
+
function relevanssi_excerpt_pre_the_content() {
|
| 1412 |
+
// This will print out the attachment file name in front of the excerpt, and we
|
| 1413 |
+
// don't want that.
|
| 1414 |
+
remove_filter( 'the_content', 'prepend_attachment' );
|
| 1415 |
+
|
| 1416 |
+
remove_shortcode( 'noindex' );
|
| 1417 |
+
add_shortcode( 'noindex', 'relevanssi_noindex_shortcode_indexing' );
|
| 1418 |
+
}
|
| 1419 |
+
|
| 1420 |
+
/**
|
| 1421 |
+
* Adjusts things after `the_content` is applied in excerpt-building.
|
| 1422 |
+
*
|
| 1423 |
+
* Reapplies the `prepend_attachment` filter hook and disables the `noindex`
|
| 1424 |
+
* shortcode.
|
| 1425 |
+
*/
|
| 1426 |
+
function relevanssi_excerpt_post_the_content() {
|
| 1427 |
+
add_filter( 'the_content', 'prepend_attachment' );
|
| 1428 |
+
|
| 1429 |
+
remove_shortcode( 'noindex' );
|
| 1430 |
+
add_shortcode( 'noindex', 'relevanssi_noindex_shortcode' );
|
| 1431 |
+
}
|
lib/indexing.php
CHANGED
|
@@ -483,8 +483,9 @@ function relevanssi_index_doc( $index_post, $remove_first = false, $custom_field
|
|
| 483 |
* can be a boolean, or a string containing an explanation for the
|
| 484 |
* exclusion. Default false.
|
| 485 |
* @param int The post ID.
|
|
|
|
| 486 |
*/
|
| 487 |
-
$do_not_index = apply_filters( 'relevanssi_do_not_index', false, $post->ID );
|
| 488 |
if ( $do_not_index ) {
|
| 489 |
// Filter says no.
|
| 490 |
if ( true === $do_not_index ) {
|
| 483 |
* can be a boolean, or a string containing an explanation for the
|
| 484 |
* exclusion. Default false.
|
| 485 |
* @param int The post ID.
|
| 486 |
+
* @param WP_Post The post object.
|
| 487 |
*/
|
| 488 |
+
$do_not_index = apply_filters( 'relevanssi_do_not_index', false, $post->ID, $post );
|
| 489 |
if ( $do_not_index ) {
|
| 490 |
// Filter says no.
|
| 491 |
if ( true === $do_not_index ) {
|
lib/init.php
CHANGED
|
@@ -49,6 +49,11 @@ add_action( 'relevanssi_trim_logs', 'relevanssi_trim_logs' );
|
|
| 49 |
add_action( 'relevanssi_update_counts', 'relevanssi_update_counts' );
|
| 50 |
add_action( 'relevanssi_custom_field_value', 'relevanssi_filter_custom_fields', 10, 2 );
|
| 51 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
// Page builder shortcodes.
|
| 53 |
add_filter( 'relevanssi_pre_excerpt_content', 'relevanssi_remove_page_builder_shortcodes', 9 );
|
| 54 |
add_filter( 'relevanssi_post_content', 'relevanssi_remove_page_builder_shortcodes', 9 );
|
| 49 |
add_action( 'relevanssi_update_counts', 'relevanssi_update_counts' );
|
| 50 |
add_action( 'relevanssi_custom_field_value', 'relevanssi_filter_custom_fields', 10, 2 );
|
| 51 |
|
| 52 |
+
// Excerpts and highlights.
|
| 53 |
+
add_action( 'relevanssi_pre_the_content', 'relevanssi_kill_autoembed' );
|
| 54 |
+
add_action( 'relevanssi_pre_the_content', 'relevanssi_excerpt_pre_the_content' );
|
| 55 |
+
add_action( 'relevanssi_post_the_content', 'relevanssi_excerpt_post_the_content' );
|
| 56 |
+
|
| 57 |
// Page builder shortcodes.
|
| 58 |
add_filter( 'relevanssi_pre_excerpt_content', 'relevanssi_remove_page_builder_shortcodes', 9 );
|
| 59 |
add_filter( 'relevanssi_post_content', 'relevanssi_remove_page_builder_shortcodes', 9 );
|
lib/utils.php
CHANGED
|
@@ -704,7 +704,10 @@ function relevanssi_select( string $option, string $value ) {
|
|
| 704 |
*
|
| 705 |
* @return string The content with tags stripped.
|
| 706 |
*/
|
| 707 |
-
function relevanssi_strip_all_tags(
|
|
|
|
|
|
|
|
|
|
| 708 |
return preg_replace( '/<[!a-zA-Z\/][^>]*>/', ' ', $content );
|
| 709 |
}
|
| 710 |
|
| 704 |
*
|
| 705 |
* @return string The content with tags stripped.
|
| 706 |
*/
|
| 707 |
+
function relevanssi_strip_all_tags( $content ) : string {
|
| 708 |
+
if ( ! is_string( $content ) ) {
|
| 709 |
+
$content = '';
|
| 710 |
+
}
|
| 711 |
return preg_replace( '/<[!a-zA-Z\/][^>]*>/', ' ', $content );
|
| 712 |
}
|
| 713 |
|
readme.txt
CHANGED
|
@@ -5,7 +5,7 @@ Tags: search, relevance, better search, product search, woocommerce search
|
|
| 5 |
Requires at least: 4.9
|
| 6 |
Tested up to: 5.7
|
| 7 |
Requires PHP: 7.0
|
| 8 |
-
Stable tag: 4.12.
|
| 9 |
License: GPLv2 or later
|
| 10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 11 |
|
|
@@ -131,6 +131,11 @@ Each document database is full of useless words. All the little words that appea
|
|
| 131 |
* John Calahan for extensive 4.0 beta testing.
|
| 132 |
|
| 133 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
= 4.12.3 =
|
| 135 |
* Major fix: Post type weights did not work; improving the caching had broken them.
|
| 136 |
* Minor fix: Relevanssi works better with soft hyphens now, removing them in indexing and excerpt-building.
|
|
@@ -220,6 +225,9 @@ Each document database is full of useless words. All the little words that appea
|
|
| 220 |
* Minor fix: The category inclusion and exclusion setting checkboxes on the Searching tab didn't work. The setting was saved, but the checkboxes wouldn't appear.
|
| 221 |
|
| 222 |
== Upgrade notice ==
|
|
|
|
|
|
|
|
|
|
| 223 |
= 4.12.3 =
|
| 224 |
* Fixes post type weights and WPML indexing problems.
|
| 225 |
|
| 5 |
Requires at least: 4.9
|
| 6 |
Tested up to: 5.7
|
| 7 |
Requires PHP: 7.0
|
| 8 |
+
Stable tag: 4.12.4
|
| 9 |
License: GPLv2 or later
|
| 10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 11 |
|
| 131 |
* John Calahan for extensive 4.0 beta testing.
|
| 132 |
|
| 133 |
== Changelog ==
|
| 134 |
+
= 4.12.4 =
|
| 135 |
+
* New feature: New action hooks `relevanssi_pre_the_content` and `relevanssi_post_the_content` fire before and after Relevanssi applies `the_content` filter to the post excerpts. Some Relevanssi default behaviour has been moved to these hooks so it can be modified.
|
| 136 |
+
* Changed behaviour: The `relevanssi_do_not_index` gets the post object as a third parameter.
|
| 137 |
+
* Minor fix: Remove errors from `relevanssi_strip_all_tags()` getting a `null` parameter.
|
| 138 |
+
|
| 139 |
= 4.12.3 =
|
| 140 |
* Major fix: Post type weights did not work; improving the caching had broken them.
|
| 141 |
* Minor fix: Relevanssi works better with soft hyphens now, removing them in indexing and excerpt-building.
|
| 225 |
* Minor fix: The category inclusion and exclusion setting checkboxes on the Searching tab didn't work. The setting was saved, but the checkboxes wouldn't appear.
|
| 226 |
|
| 227 |
== Upgrade notice ==
|
| 228 |
+
= 4.12.4 =
|
| 229 |
+
* Fixes minor bugs.
|
| 230 |
+
|
| 231 |
= 4.12.3 =
|
| 232 |
* Fixes post type weights and WPML indexing problems.
|
| 233 |
|
relevanssi.php
CHANGED
|
@@ -13,7 +13,7 @@
|
|
| 13 |
* Plugin Name: Relevanssi
|
| 14 |
* Plugin URI: https://www.relevanssi.com/
|
| 15 |
* Description: This plugin replaces WordPress search with a relevance-sorting search.
|
| 16 |
-
* Version: 4.12.
|
| 17 |
* Author: Mikko Saari
|
| 18 |
* Author URI: http://www.mikkosaari.fi/
|
| 19 |
* Text Domain: relevanssi
|
|
@@ -67,7 +67,7 @@ $relevanssi_variables['database_version'] = 6;
|
|
| 67 |
$relevanssi_variables['file'] = __FILE__;
|
| 68 |
$relevanssi_variables['plugin_dir'] = plugin_dir_path( __FILE__ );
|
| 69 |
$relevanssi_variables['plugin_basename'] = plugin_basename( __FILE__ );
|
| 70 |
-
$relevanssi_variables['plugin_version'] = '4.12.
|
| 71 |
|
| 72 |
require_once 'lib/admin-ajax.php';
|
| 73 |
require_once 'lib/common.php';
|
| 13 |
* Plugin Name: Relevanssi
|
| 14 |
* Plugin URI: https://www.relevanssi.com/
|
| 15 |
* Description: This plugin replaces WordPress search with a relevance-sorting search.
|
| 16 |
+
* Version: 4.12.4
|
| 17 |
* Author: Mikko Saari
|
| 18 |
* Author URI: http://www.mikkosaari.fi/
|
| 19 |
* Text Domain: relevanssi
|
| 67 |
$relevanssi_variables['file'] = __FILE__;
|
| 68 |
$relevanssi_variables['plugin_dir'] = plugin_dir_path( __FILE__ );
|
| 69 |
$relevanssi_variables['plugin_basename'] = plugin_basename( __FILE__ );
|
| 70 |
+
$relevanssi_variables['plugin_version'] = '4.12.4';
|
| 71 |
|
| 72 |
require_once 'lib/admin-ajax.php';
|
| 73 |
require_once 'lib/common.php';
|
