Skip to main contentSkip to footer

Setting post_type to page doesn’t work

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

Indexing embedded PDFs for the parent post

…post_id FROM $wpdb->postmeta WHERE meta_key = ‘_wp_attached_file’ AND meta_value = %s )”, $pdf_url ) ); $content .= $pdf_content; } return $content; } DearFlip DearFlip uses a shortcode that points to the flipbook post, which has a custom field with the PDF URL: add_filter( ‘relevanssi_content_to_index’, ‘rlv_dearflip_content’, 10, 2 ); function rlv_dearflip_content(…

WP All Import
By default posts imported with WP All Import do not get indexed by Relevanssi. The importing process does not trigger…

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