Skip to main contentSkip to footer

For some reason setting the post_type query variable to page doesn’t have the desired effect. Other post types (post, custom post types) work, but page doesn’t do anything.

This is not a Relevanssi bug, but a WordPress feature (see this trac ticket). If the user inputs a bad value to the post_type query variable, WordPress changes it to any. For some reason that happens also when the post_type is set to page, even though that should be a valid value.

There’s nothing Relevanssi can do about this. However, there’s a fix. Relevanssi introduces a new query variable post_types, which happily accepts page. Use that, if you need to filter by post type.

(Update 19.1.2021: This WordPress bug still isn’t fixed!)

Your account

Not logged in. Log in to see your license details.

Search

Popular Resources

Reading wpDataTables imported tables

…preg_match_all( ‘/\[wpdatatable id=(\d*)\s?.*\]/’, $content, $matches ); if ( ! $m ) { return $content; } global $wpdb; foreach ( $matches[1] as $table_id ) { $table_query = $wpdb->prepare( ‘SELECT * FROM `’ . $wpdb->prefix . ‘wpdatatables` WHERE id=%d’, intval( $table_id ) ); $table_config = $wpdb->get_row( $table_query, OBJECT ); $table_content = $wpdb->get_results(…The wpDataTables table plugin has several ways to handle tables. Some of them work with Relevanssi without problems; some don’t. You may notice that Relevanssi doesn’t index the entire table contents for wpDataTables tables (mainly imported tables). This is because the wpDataTables shortcode does not always expand to the entire……$wpdb->get_results( $table_config->content, ARRAY_A ); $table_value = relevanssi_flatten_array( $table_content ); $content .= ‘ ‘ . $table_value; } return $content; } This function hooks onto relevanssi_post_content and looks for [wpdatatable] shortcodes, and if it finds one, it fetches all the table contents from the database and adds them to the post content….

How to display relevancy score
Relevanssi stores the relevance score it uses to sort results in the $post variable. Just add something like <?php echo…

Related Posts:

Comment Section:

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed