php facetwp搜索附件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php facetwp搜索附件相关的知识,希望对你有一定的参考价值。

<?php
/**
 * make sure both publish and inherit (for attachments) are searched on the search page
 * Relevanssi has an option to index attachments but the query facet detects does not include attachments
 * because it does not include post_status inherit
 */
add_action( 'pre_get_posts', function( $query ) {
	if ( $query->is_search() ) {
		$statuses = $query->get( 'post_status' );
		$query->set( 'post_status', array_merge( (array)$statuses, array( 'publish', 'inherit' ) ) );
	}
});

以上是关于php facetwp搜索附件的主要内容,如果未能解决你的问题,请参考以下文章

php 带有附件ID的布局构建器中的facetwp自定义字段

php FacetWP - 将搜索网址重写为目录

php facetwp过滤wp搜索表单

php facetwp搜索占位符

php facetwp搜索占位符

php facetwp在加载后可以在listify主页上显示搜索过滤器