fix: align CHRNX title eligibility

This commit is contained in:
chrnx committed 2026-08-11 16:06:47 -05:00
1 parent dab82cfa06
commit a769228c01
3 files changed
+66 -29

No files matched your search

+3 -4
View File
@@ -17,7 +17,7 @@ function chrnx_is_eligible_editorial_post( $post ) {
return $post instanceof WP_Post
&& 'post' === $post->post_type
&& 'publish' === $post->post_status
&& '' !== trim( wp_strip_all_tags( $post->post_title ) );
&& 1 === preg_match( '/[^[:space:]]/', $post->post_title );
}
/** Clear request-local editorial query results after relevant mutations. */
@@ -76,8 +76,7 @@ function chrnx_filter_nonempty_editorial_titles( $where, $query ) {
}
global $wpdb;
$visible_text_pattern = '(^|>)[[:space:]]*[^<[:space:]][^<]*(<|$)';
return $where . $wpdb->prepare( ' AND ' . $wpdb->posts . '.post_title REGEXP %s', $visible_text_pattern );
return $where . $wpdb->prepare( ' AND ' . $wpdb->posts . '.post_title REGEXP %s', '[^[:space:]]' );
}
/**
@@ -138,7 +137,7 @@ function chrnx_get_eligible_editorial_post_ids( $extra_args = array() ) {
}
$query = chrnx_run_eligible_query( $args );
$ids = array_values( array_map( 'absint', array_filter( $query->posts, 'chrnx_is_eligible_editorial_post' ) ) );
$ids = array_values( array_map( 'absint', $query->posts ) );
if ( ! empty( $ids ) ) {
_prime_post_caches( $ids, true, true );
}