Version Description
- Changed behaviour: The
relevanssi_excerpt_partfilter hook now gets the post ID as a second parameter. The documentation for the filter has been fixed to match actual use: this filter is applied to the excerpt part after the highlighting and the ellipsis have been added. - Changed behaviour: The
relevanssi_index_custom_fieldsfilter hook is no longer used when determining which custom fields are used for phrase searching. If you have a use case where this change matters, please contact us. - Minor fix: The
relevanssi_excerptfilter hook was removed in 4.9.0. It is now restored and behaves the way it did before. - Minor fix: Avoids undefined variable warnings from the Pretty Links compatibility code.
- Minor fix: The Oxygen Builder compatibility has been improved. Now shortcodes in Oxygen Builder content are expanded, if that setting is enabled in Relevanssi settings.
Download this release
Release Info
| Developer | msaari |
| Plugin | |
| Version | 4.9.1 |
| Comparing to | |
| See all releases | |
Code changes from version 4.9.0 to 4.9.1
- lib/common.php +63 -3
- lib/compatibility/oxygen.php +12 -5
- lib/compatibility/pretty-links.php +1 -1
- lib/excerpts-highlights.php +62 -57
- lib/indexing.php +6 -35
- lib/init.php +1 -0
- lib/tabs/debugging-tab.php +6 -2
- readme.txt +11 -1
- relevanssi.php +2 -2
lib/common.php
CHANGED
|
@@ -414,8 +414,7 @@ function relevanssi_recognize_phrases( $search_query, $operator = 'AND' ) {
|
|
| 414 |
return $all_queries;
|
| 415 |
}
|
| 416 |
|
| 417 |
-
|
| 418 |
-
$custom_fields = apply_filters( 'relevanssi_index_custom_fields', relevanssi_get_custom_fields() );
|
| 419 |
$taxonomies = get_option( 'relevanssi_index_taxonomies_list', array() );
|
| 420 |
$excerpts = get_option( 'relevanssi_index_excerpt', 'off' );
|
| 421 |
$index_pdf_parent = get_option( 'relevanssi_index_pdf_parent' );
|
|
@@ -539,7 +538,9 @@ function relevanssi_generate_phrase_queries( $phrases, $taxonomies, $custom_fiel
|
|
| 539 |
$keys = '';
|
| 540 |
|
| 541 |
if ( is_array( $custom_fields ) ) {
|
| 542 |
-
|
|
|
|
|
|
|
| 543 |
|
| 544 |
if ( strpos( implode( ' ', $custom_fields ), '%' ) ) {
|
| 545 |
// ACF repeater fields involved.
|
|
@@ -2484,3 +2485,62 @@ function relevanssi_strip_tags( $content ) {
|
|
| 2484 |
get_option( 'relevanssi_excerpt_allowable_tags', '' )
|
| 2485 |
);
|
| 2486 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 414 |
return $all_queries;
|
| 415 |
}
|
| 416 |
|
| 417 |
+
$custom_fields = relevanssi_get_custom_fields();
|
|
|
|
| 418 |
$taxonomies = get_option( 'relevanssi_index_taxonomies_list', array() );
|
| 419 |
$excerpts = get_option( 'relevanssi_index_excerpt', 'off' );
|
| 420 |
$index_pdf_parent = get_option( 'relevanssi_index_pdf_parent' );
|
| 538 |
$keys = '';
|
| 539 |
|
| 540 |
if ( is_array( $custom_fields ) ) {
|
| 541 |
+
if ( ! in_array( '_relevanssi_pdf_content', $custom_fields, true ) ) {
|
| 542 |
+
array_push( $custom_fields, '_relevanssi_pdf_content' );
|
| 543 |
+
}
|
| 544 |
|
| 545 |
if ( strpos( implode( ' ', $custom_fields ), '%' ) ) {
|
| 546 |
// ACF repeater fields involved.
|
| 2485 |
get_option( 'relevanssi_excerpt_allowable_tags', '' )
|
| 2486 |
);
|
| 2487 |
}
|
| 2488 |
+
|
| 2489 |
+
/**
|
| 2490 |
+
* Generates a list of custom fields for a post.
|
| 2491 |
+
*
|
| 2492 |
+
* Starts from the custom field setting, expands "all" or "visible" if
|
| 2493 |
+
* necessary, makes sure "_relevanssi_pdf_content" is not removed, applies the
|
| 2494 |
+
* 'relevanssi_index_custom_fields' filter and 'relevanssi_add_repeater_fields'
|
| 2495 |
+
* function.
|
| 2496 |
+
*
|
| 2497 |
+
* @param int $post_id The post ID.
|
| 2498 |
+
* @param array|string $custom_fields An array of custom field names, or "all"
|
| 2499 |
+
* or "visible". If null, uses relevanssi_get_custom_fields().
|
| 2500 |
+
*
|
| 2501 |
+
* @return array An array of custom field names.
|
| 2502 |
+
*/
|
| 2503 |
+
function relevanssi_generate_list_of_custom_fields( $post_id, $custom_fields = null ) {
|
| 2504 |
+
if ( ! $custom_fields ) {
|
| 2505 |
+
$custom_fields = relevanssi_get_custom_fields();
|
| 2506 |
+
}
|
| 2507 |
+
$remove_underscore_fields = 'visible' === $custom_fields ? true : false;
|
| 2508 |
+
if ( 'all' === $custom_fields || 'visible' === $custom_fields ) {
|
| 2509 |
+
$custom_fields = get_post_custom_keys( $post_id );
|
| 2510 |
+
}
|
| 2511 |
+
|
| 2512 |
+
if ( ! is_array( $custom_fields ) ) {
|
| 2513 |
+
return array();
|
| 2514 |
+
}
|
| 2515 |
+
|
| 2516 |
+
$custom_fields = array_unique( $custom_fields );
|
| 2517 |
+
if ( $remove_underscore_fields ) {
|
| 2518 |
+
$custom_fields = array_filter(
|
| 2519 |
+
$custom_fields,
|
| 2520 |
+
function( $field ) {
|
| 2521 |
+
if ( '_relevanssi_pdf_content' === $field || '_' !== substr( $field, 0, 1 ) ) {
|
| 2522 |
+
return $field;
|
| 2523 |
+
}
|
| 2524 |
+
}
|
| 2525 |
+
);
|
| 2526 |
+
}
|
| 2527 |
+
|
| 2528 |
+
// Premium includes some support for ACF repeater fields.
|
| 2529 |
+
if ( function_exists( 'relevanssi_add_repeater_fields' ) ) {
|
| 2530 |
+
relevanssi_add_repeater_fields( $custom_fields, $post_id );
|
| 2531 |
+
}
|
| 2532 |
+
|
| 2533 |
+
/**
|
| 2534 |
+
* Filters the list of custom fields to index before indexing.
|
| 2535 |
+
*
|
| 2536 |
+
* @param array $custom_fields List of custom field names.
|
| 2537 |
+
* @param int $post_id The post ID.
|
| 2538 |
+
*/
|
| 2539 |
+
$custom_fields = apply_filters( 'relevanssi_index_custom_fields', $custom_fields, $post_id );
|
| 2540 |
+
if ( ! is_array( $custom_fields ) ) {
|
| 2541 |
+
return array();
|
| 2542 |
+
}
|
| 2543 |
+
$custom_fields = array_filter( $custom_fields );
|
| 2544 |
+
|
| 2545 |
+
return $custom_fields;
|
| 2546 |
+
}
|
lib/compatibility/oxygen.php
CHANGED
|
@@ -38,11 +38,14 @@ function relevanssi_oxygen_compatibility( $value, $field, $post_id ) {
|
|
| 38 |
|
| 39 |
$content_tags = explode( '[ct_section', $value[0] );
|
| 40 |
$page_content = '';
|
|
|
|
| 41 |
foreach ( $content_tags as $content ) {
|
| 42 |
if ( empty( $content ) ) {
|
| 43 |
continue;
|
| 44 |
}
|
| 45 |
-
|
|
|
|
|
|
|
| 46 |
/**
|
| 47 |
* Allows defining filters to remove Oxygen Builder sections.
|
| 48 |
*
|
|
@@ -72,14 +75,14 @@ function relevanssi_oxygen_compatibility( $value, $field, $post_id ) {
|
|
| 72 |
);
|
| 73 |
|
| 74 |
$content = preg_replace(
|
| 75 |
-
'/\[.*?\]/',
|
| 76 |
' ',
|
| 77 |
/**
|
| 78 |
* Filters the Oxygen Builder section content before the
|
| 79 |
-
* shortcode tags are removed.
|
| 80 |
*
|
| 81 |
* @param string $content The single section content.
|
| 82 |
-
* @param
|
| 83 |
*
|
| 84 |
* @return string
|
| 85 |
*/
|
|
@@ -92,7 +95,11 @@ function relevanssi_oxygen_compatibility( $value, $field, $post_id ) {
|
|
| 92 |
|
| 93 |
$page_content .= $content;
|
| 94 |
}
|
| 95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
$value[0] = $page_content;
|
| 97 |
}
|
| 98 |
return $value;
|
| 38 |
|
| 39 |
$content_tags = explode( '[ct_section', $value[0] );
|
| 40 |
$page_content = '';
|
| 41 |
+
|
| 42 |
foreach ( $content_tags as $content ) {
|
| 43 |
if ( empty( $content ) ) {
|
| 44 |
continue;
|
| 45 |
}
|
| 46 |
+
if ( '[' !== substr( $content, 0, 1 ) ) {
|
| 47 |
+
$content = '[ct_section' . $content;
|
| 48 |
+
}
|
| 49 |
/**
|
| 50 |
* Allows defining filters to remove Oxygen Builder sections.
|
| 51 |
*
|
| 75 |
);
|
| 76 |
|
| 77 |
$content = preg_replace(
|
| 78 |
+
'/\[\/?ct_.*?\]/',
|
| 79 |
' ',
|
| 80 |
/**
|
| 81 |
* Filters the Oxygen Builder section content before the
|
| 82 |
+
* Oxygen Builder shortcode tags are removed.
|
| 83 |
*
|
| 84 |
* @param string $content The single section content.
|
| 85 |
+
* @param int $post_id The post ID.
|
| 86 |
*
|
| 87 |
* @return string
|
| 88 |
*/
|
| 95 |
|
| 96 |
$page_content .= $content;
|
| 97 |
}
|
| 98 |
+
if ( 'on' === get_option( 'relevanssi_expand_shortcodes' ) ) {
|
| 99 |
+
$page_content = do_shortcode( $page_content );
|
| 100 |
+
} else {
|
| 101 |
+
$page_content = strip_shortcodes( $page_content );
|
| 102 |
+
}
|
| 103 |
$value[0] = $page_content;
|
| 104 |
}
|
| 105 |
return $value;
|
lib/compatibility/pretty-links.php
CHANGED
|
@@ -23,7 +23,7 @@ add_filter( 'relevanssi_search_ok', 'relevanssi_pretty_links_ok', 10, 2 );
|
|
| 23 |
* @return boolean False if this is a Pretty Links query.
|
| 24 |
*/
|
| 25 |
function relevanssi_pretty_links_ok( $ok, $query ) {
|
| 26 |
-
if ( 'pretty-link' === $query->query['post_type'] ) {
|
| 27 |
$ok = false;
|
| 28 |
}
|
| 29 |
return $ok;
|
| 23 |
* @return boolean False if this is a Pretty Links query.
|
| 24 |
*/
|
| 25 |
function relevanssi_pretty_links_ok( $ok, $query ) {
|
| 26 |
+
if ( isset( $query->query['post_type'] ) && 'pretty-link' === $query->query['post_type'] ) {
|
| 27 |
$ok = false;
|
| 28 |
}
|
| 29 |
return $ok;
|
lib/excerpts-highlights.php
CHANGED
|
@@ -248,6 +248,19 @@ function relevanssi_do_excerpt( $t_post, $query, $excerpt_length = null, $excerp
|
|
| 248 |
$whole_post_excerpted = true;
|
| 249 |
}
|
| 250 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 251 |
if ( 'none' !== $highlight ) {
|
| 252 |
if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
|
| 253 |
$excerpt['text'] = relevanssi_highlight_terms( $excerpt['text'], $query );
|
|
@@ -266,10 +279,25 @@ function relevanssi_do_excerpt( $t_post, $query, $excerpt_length = null, $excerp
|
|
| 266 |
}
|
| 267 |
}
|
| 268 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
$excerpt_text .= apply_filters(
|
| 270 |
'relevanssi_excerpt_part',
|
| 271 |
'<span class="excerpt_part">' . $excerpt['text'] . '</span>',
|
| 272 |
-
$excerpt
|
|
|
|
| 273 |
);
|
| 274 |
}
|
| 275 |
|
|
@@ -1255,73 +1283,50 @@ function relevanssi_add_accent_variations( $word ) {
|
|
| 1255 |
* @return string The custom field content.
|
| 1256 |
*/
|
| 1257 |
function relevanssi_get_custom_field_content( $post_id ) {
|
| 1258 |
-
$custom_field_content
|
| 1259 |
-
$remove_underscore_fields = false;
|
| 1260 |
|
| 1261 |
-
$custom_fields =
|
| 1262 |
-
if ( isset( $custom_fields ) && 'all' === $custom_fields ) {
|
| 1263 |
-
$custom_fields = get_post_custom_keys( $post_id );
|
| 1264 |
-
}
|
| 1265 |
-
if ( isset( $custom_fields ) && 'visible' === $custom_fields ) {
|
| 1266 |
-
$custom_fields = get_post_custom_keys( $post_id );
|
| 1267 |
-
$remove_underscore_fields = true;
|
| 1268 |
-
}
|
| 1269 |
-
/* Documented in lib/indexing.php. */
|
| 1270 |
-
$custom_fields = apply_filters( 'relevanssi_index_custom_fields', $custom_fields, $post_id );
|
| 1271 |
|
| 1272 |
if ( function_exists( 'relevanssi_get_child_pdf_content' ) ) {
|
| 1273 |
$custom_field_content .= ' ' . relevanssi_get_child_pdf_content( $post_id );
|
| 1274 |
}
|
| 1275 |
|
| 1276 |
-
|
| 1277 |
-
|
| 1278 |
-
|
| 1279 |
-
|
| 1280 |
-
|
| 1281 |
-
|
| 1282 |
-
|
| 1283 |
-
foreach ( $custom_fields as $field ) {
|
| 1284 |
-
if ( $remove_underscore_fields ) {
|
| 1285 |
-
if ( '_' === substr( $field, 0, 1 ) ) {
|
| 1286 |
-
continue;
|
| 1287 |
-
}
|
| 1288 |
-
}
|
| 1289 |
-
/* Documented in lib/indexing.php. */
|
| 1290 |
-
$values = apply_filters(
|
| 1291 |
-
'relevanssi_custom_field_value',
|
| 1292 |
-
get_post_meta(
|
| 1293 |
-
$post_id,
|
| 1294 |
-
$field,
|
| 1295 |
-
false
|
| 1296 |
-
),
|
| 1297 |
$field,
|
| 1298 |
-
|
| 1299 |
-
)
|
| 1300 |
-
|
| 1301 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1302 |
}
|
| 1303 |
-
foreach ( $values as $value ) {
|
| 1304 |
-
// Quick hack : allow indexing of PODS relationship custom fields. @author TMV.
|
| 1305 |
-
if ( is_array( $value ) && isset( $value['post_title'] ) ) {
|
| 1306 |
-
$value = $value['post_title'];
|
| 1307 |
-
}
|
| 1308 |
|
| 1309 |
-
|
| 1310 |
-
|
| 1311 |
-
|
| 1312 |
-
|
| 1313 |
-
|
| 1314 |
-
|
| 1315 |
-
|
| 1316 |
-
|
| 1317 |
-
|
| 1318 |
-
}
|
| 1319 |
}
|
| 1320 |
-
|
| 1321 |
-
|
| 1322 |
-
|
| 1323 |
-
$custom_field_content .= ' ' . $value;
|
| 1324 |
}
|
|
|
|
| 1325 |
}
|
| 1326 |
}
|
| 1327 |
/**
|
| 248 |
$whole_post_excerpted = true;
|
| 249 |
}
|
| 250 |
|
| 251 |
+
/**
|
| 252 |
+
* Filters excerpt text.
|
| 253 |
+
*
|
| 254 |
+
* Filters the individual excerpt part text (full excerpt in the free
|
| 255 |
+
* version) before highlighting and ellipsis addition.
|
| 256 |
+
*
|
| 257 |
+
* @param string The excerpt text.
|
| 258 |
+
* @param int The post ID.
|
| 259 |
+
*
|
| 260 |
+
* @return string
|
| 261 |
+
*/
|
| 262 |
+
$excerpt['text'] = apply_filters( 'relevanssi_excerpt', $excerpt['text'], $post->ID );
|
| 263 |
+
|
| 264 |
if ( 'none' !== $highlight ) {
|
| 265 |
if ( ! is_admin() || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
|
| 266 |
$excerpt['text'] = relevanssi_highlight_terms( $excerpt['text'], $query );
|
| 279 |
}
|
| 280 |
}
|
| 281 |
|
| 282 |
+
/**
|
| 283 |
+
* Filters individual excerpt parts.
|
| 284 |
+
*
|
| 285 |
+
* Filters the individual excerpt parts (full excerpt in the free
|
| 286 |
+
* version) after highlighting, ellipsis and the wrapping span tag have
|
| 287 |
+
* been added.
|
| 288 |
+
*
|
| 289 |
+
* @param string The excerpt text.
|
| 290 |
+
* @param array The excerpt array (keys 'text', 'start', 'source',
|
| 291 |
+
* 'hits').
|
| 292 |
+
* @param int The post ID.
|
| 293 |
+
*
|
| 294 |
+
* @return string
|
| 295 |
+
*/
|
| 296 |
$excerpt_text .= apply_filters(
|
| 297 |
'relevanssi_excerpt_part',
|
| 298 |
'<span class="excerpt_part">' . $excerpt['text'] . '</span>',
|
| 299 |
+
$excerpt,
|
| 300 |
+
$post->ID
|
| 301 |
);
|
| 302 |
}
|
| 303 |
|
| 1283 |
* @return string The custom field content.
|
| 1284 |
*/
|
| 1285 |
function relevanssi_get_custom_field_content( $post_id ) {
|
| 1286 |
+
$custom_field_content = '';
|
|
|
|
| 1287 |
|
| 1288 |
+
$custom_fields = relevanssi_generate_list_of_custom_fields( $post_id );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1289 |
|
| 1290 |
if ( function_exists( 'relevanssi_get_child_pdf_content' ) ) {
|
| 1291 |
$custom_field_content .= ' ' . relevanssi_get_child_pdf_content( $post_id );
|
| 1292 |
}
|
| 1293 |
|
| 1294 |
+
foreach ( $custom_fields as $field ) {
|
| 1295 |
+
/* Documented in lib/indexing.php. */
|
| 1296 |
+
$values = apply_filters(
|
| 1297 |
+
'relevanssi_custom_field_value',
|
| 1298 |
+
get_post_meta(
|
| 1299 |
+
$post_id,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1300 |
$field,
|
| 1301 |
+
false
|
| 1302 |
+
),
|
| 1303 |
+
$field,
|
| 1304 |
+
$post_id
|
| 1305 |
+
);
|
| 1306 |
+
if ( empty( $values ) || ! is_array( $values ) ) {
|
| 1307 |
+
continue;
|
| 1308 |
+
}
|
| 1309 |
+
foreach ( $values as $value ) {
|
| 1310 |
+
// Quick hack : allow indexing of PODS relationship custom fields. @author TMV.
|
| 1311 |
+
if ( is_array( $value ) && isset( $value['post_title'] ) ) {
|
| 1312 |
+
$value = $value['post_title'];
|
| 1313 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1314 |
|
| 1315 |
+
// Flatten other array data.
|
| 1316 |
+
if ( is_array( $value ) ) {
|
| 1317 |
+
$value_as_string = '';
|
| 1318 |
+
array_walk_recursive(
|
| 1319 |
+
$value,
|
| 1320 |
+
function( $val ) use ( &$value_as_string ) {
|
| 1321 |
+
if ( is_string( $val ) ) {
|
| 1322 |
+
// Sometimes this can be something weird.
|
| 1323 |
+
$value_as_string .= ' ' . $val;
|
|
|
|
| 1324 |
}
|
| 1325 |
+
}
|
| 1326 |
+
);
|
| 1327 |
+
$value = $value_as_string;
|
|
|
|
| 1328 |
}
|
| 1329 |
+
$custom_field_content .= ' ' . $value;
|
| 1330 |
}
|
| 1331 |
}
|
| 1332 |
/**
|
lib/indexing.php
CHANGED
|
@@ -1197,7 +1197,9 @@ function relevanssi_index_author( &$insert_data, $post_author, $min_word_length,
|
|
| 1197 |
*
|
| 1198 |
* @param array $insert_data The INSERT query data. Modified here.
|
| 1199 |
* @param int $post_id The indexed post ID.
|
| 1200 |
-
* @param string|array $custom_fields The custom fields to index.
|
|
|
|
|
|
|
| 1201 |
* @param int $min_word_length The minimum word length.
|
| 1202 |
* @param boolean $debug If true, print out debug notices.
|
| 1203 |
*
|
|
@@ -1206,42 +1208,11 @@ function relevanssi_index_author( &$insert_data, $post_author, $min_word_length,
|
|
| 1206 |
function relevanssi_index_custom_fields( &$insert_data, $post_id, $custom_fields, $min_word_length, $debug ) {
|
| 1207 |
$n = 0;
|
| 1208 |
|
| 1209 |
-
$
|
| 1210 |
-
if (
|
| 1211 |
-
|
| 1212 |
-
}
|
| 1213 |
-
|
| 1214 |
-
/**
|
| 1215 |
-
* Filters the list of custom fields to index before indexing.
|
| 1216 |
-
*
|
| 1217 |
-
* @param array $custom_fields List of custom field names.
|
| 1218 |
-
* @param int $post_id The post ID.
|
| 1219 |
-
*/
|
| 1220 |
-
$custom_fields = apply_filters( 'relevanssi_index_custom_fields', $custom_fields, $post_id );
|
| 1221 |
-
|
| 1222 |
-
if ( ! is_array( $custom_fields ) ) {
|
| 1223 |
-
return 0;
|
| 1224 |
-
}
|
| 1225 |
-
|
| 1226 |
-
$custom_fields = array_unique( $custom_fields );
|
| 1227 |
-
if ( $remove_underscore_fields ) {
|
| 1228 |
-
$custom_fields = array_filter(
|
| 1229 |
-
$custom_fields,
|
| 1230 |
-
function( $field ) {
|
| 1231 |
-
if ( '_relevanssi_pdf_content' === $field || '_' !== substr( $field, 0, 1 ) ) {
|
| 1232 |
-
return $field;
|
| 1233 |
-
}
|
| 1234 |
-
}
|
| 1235 |
-
);
|
| 1236 |
-
}
|
| 1237 |
-
|
| 1238 |
-
// Premium includes some support for ACF repeater fields.
|
| 1239 |
-
if ( function_exists( 'relevanssi_add_repeater_fields' ) ) {
|
| 1240 |
-
relevanssi_add_repeater_fields( $custom_fields, $post_id );
|
| 1241 |
}
|
| 1242 |
|
| 1243 |
-
$custom_fields = array_filter( $custom_fields );
|
| 1244 |
-
|
| 1245 |
if ( $debug ) {
|
| 1246 |
relevanssi_debug_echo( 'Custom fields to index: ' . implode( ', ', $custom_fields ) );
|
| 1247 |
}
|
| 1197 |
*
|
| 1198 |
* @param array $insert_data The INSERT query data. Modified here.
|
| 1199 |
* @param int $post_id The indexed post ID.
|
| 1200 |
+
* @param string|array $custom_fields The custom fields to index. Only allowed
|
| 1201 |
+
* string values are "all" and "visible". If you wish to specify a single custom
|
| 1202 |
+
* field, wrap it in an array.
|
| 1203 |
* @param int $min_word_length The minimum word length.
|
| 1204 |
* @param boolean $debug If true, print out debug notices.
|
| 1205 |
*
|
| 1208 |
function relevanssi_index_custom_fields( &$insert_data, $post_id, $custom_fields, $min_word_length, $debug ) {
|
| 1209 |
$n = 0;
|
| 1210 |
|
| 1211 |
+
$custom_fields = relevanssi_generate_list_of_custom_fields( $post_id, $custom_fields );
|
| 1212 |
+
if ( empty( $custom_fields ) ) {
|
| 1213 |
+
return $n;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1214 |
}
|
| 1215 |
|
|
|
|
|
|
|
| 1216 |
if ( $debug ) {
|
| 1217 |
relevanssi_debug_echo( 'Custom fields to index: ' . implode( ', ', $custom_fields ) );
|
| 1218 |
}
|
lib/init.php
CHANGED
|
@@ -322,6 +322,7 @@ function relevanssi_query_vars( $qv ) {
|
|
| 322 |
$qv[] = 'highlight';
|
| 323 |
$qv[] = 'posts_per_page';
|
| 324 |
$qv[] = 'post_parent';
|
|
|
|
| 325 |
|
| 326 |
return $qv;
|
| 327 |
}
|
| 322 |
$qv[] = 'highlight';
|
| 323 |
$qv[] = 'posts_per_page';
|
| 324 |
$qv[] = 'post_parent';
|
| 325 |
+
$qv[] = 'post_status';
|
| 326 |
|
| 327 |
return $qv;
|
| 328 |
}
|
lib/tabs/debugging-tab.php
CHANGED
|
@@ -28,8 +28,12 @@ function relevanssi_debugging_tab() {
|
|
| 28 |
<h2><?php esc_html_e( 'Debugging', 'relevanssi' ); ?></h2>
|
| 29 |
|
| 30 |
<p><?php esc_html_e( 'In order to figure out problems with indexing posts, you can test how Relevanssi sees the post by entering the post ID number in the field below.', 'relevanssi' ); ?></p>
|
| 31 |
-
<?php
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
<p><label for="post_id"><?php esc_html_e( 'The post ID', 'relevanssi' ); ?></label>:
|
| 34 |
<input type="text" name="post_id" id="post_id"
|
| 35 |
<?php
|
| 28 |
<h2><?php esc_html_e( 'Debugging', 'relevanssi' ); ?></h2>
|
| 29 |
|
| 30 |
<p><?php esc_html_e( 'In order to figure out problems with indexing posts, you can test how Relevanssi sees the post by entering the post ID number in the field below.', 'relevanssi' ); ?></p>
|
| 31 |
+
<?php
|
| 32 |
+
if ( ! RELEVANSSI_PREMIUM ) {
|
| 33 |
+
// Translators: %1$s starts the link, %2$s closes it.
|
| 34 |
+
printf( '<p>' . esc_html__( 'In Relevanssi Premium, you can find this feature for each post on the post edit page. %1$sBuy Relevanssi Premium here%2$s.', 'relevanssi' ) . '</p>', '<a href="https://www.relevanssi.com/buy-premium/">', '</a>' );
|
| 35 |
+
}
|
| 36 |
+
?>
|
| 37 |
<p><label for="post_id"><?php esc_html_e( 'The post ID', 'relevanssi' ); ?></label>:
|
| 38 |
<input type="text" name="post_id" id="post_id"
|
| 39 |
<?php
|
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.5.3
|
| 7 |
Requires PHP: 7.0
|
| 8 |
-
Stable tag: 4.9.
|
| 9 |
License: GPLv2 or later
|
| 10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 11 |
|
|
@@ -133,6 +133,13 @@ Each document database is full of useless words. All the little words that appea
|
|
| 133 |
* John Calahan for extensive 4.0 beta testing.
|
| 134 |
|
| 135 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
= 4.9.0 =
|
| 137 |
* New feature: There's now a "Debugging" tab in the Relevanssi settings, letting you see how the Relevanssi index sees posts. This is familiar to Premium users, but is now available in the free version as well.
|
| 138 |
* New feature: The SEO Framework plugin is now supported and posts set excluded from the search in SEO Framework settings will be excluded from the index.
|
|
@@ -203,6 +210,9 @@ Each document database is full of useless words. All the little words that appea
|
|
| 203 |
* Minor fix: User Access Manager showed drafts in search results for all users. This is now fixed.
|
| 204 |
|
| 205 |
== Upgrade notice ==
|
|
|
|
|
|
|
|
|
|
| 206 |
= 4.9.0 =
|
| 207 |
* New debugging feature, lots of minor fixes.
|
| 208 |
|
| 5 |
Requires at least: 4.9
|
| 6 |
Tested up to: 5.5.3
|
| 7 |
Requires PHP: 7.0
|
| 8 |
+
Stable tag: 4.9.1
|
| 9 |
License: GPLv2 or later
|
| 10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 11 |
|
| 133 |
* John Calahan for extensive 4.0 beta testing.
|
| 134 |
|
| 135 |
== Changelog ==
|
| 136 |
+
= 4.9.1 =
|
| 137 |
+
* Changed behaviour: The `relevanssi_excerpt_part` filter hook now gets the post ID as a second parameter. The documentation for the filter has been fixed to match actual use: this filter is applied to the excerpt part after the highlighting and the ellipsis have been added.
|
| 138 |
+
* Changed behaviour: The `relevanssi_index_custom_fields` filter hook is no longer used when determining which custom fields are used for phrase searching. If you have a use case where this change matters, please contact us.
|
| 139 |
+
* Minor fix: The `relevanssi_excerpt` filter hook was removed in 4.9.0. It is now restored and behaves the way it did before.
|
| 140 |
+
* Minor fix: Avoids undefined variable warnings from the Pretty Links compatibility code.
|
| 141 |
+
* Minor fix: The Oxygen Builder compatibility has been improved. Now shortcodes in Oxygen Builder content are expanded, if that setting is enabled in Relevanssi settings.
|
| 142 |
+
|
| 143 |
= 4.9.0 =
|
| 144 |
* New feature: There's now a "Debugging" tab in the Relevanssi settings, letting you see how the Relevanssi index sees posts. This is familiar to Premium users, but is now available in the free version as well.
|
| 145 |
* New feature: The SEO Framework plugin is now supported and posts set excluded from the search in SEO Framework settings will be excluded from the index.
|
| 210 |
* Minor fix: User Access Manager showed drafts in search results for all users. This is now fixed.
|
| 211 |
|
| 212 |
== Upgrade notice ==
|
| 213 |
+
= 4.9.1 =
|
| 214 |
+
* Bug fixing, better Oxygen Builder compatibility.
|
| 215 |
+
|
| 216 |
= 4.9.0 =
|
| 217 |
* New debugging feature, lots of minor fixes.
|
| 218 |
|
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.9.
|
| 17 |
* Author: Mikko Saari
|
| 18 |
* Author URI: http://www.mikkosaari.fi/
|
| 19 |
* Text Domain: relevanssi
|
|
@@ -67,7 +67,7 @@ $relevanssi_variables['database_version'] = 5;
|
|
| 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.9.
|
| 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.9.1
|
| 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.9.1';
|
| 71 |
|
| 72 |
require_once 'lib/admin-ajax.php';
|
| 73 |
require_once 'lib/common.php';
|
