Skip to main contentSkip to footer

If you’re using custom post statuses, Relevanssi requires some tinkering. By default, Relevanssi only handles posts that are of status publish, pending, draft or private.

Relevanssi has a filter that lets you add more statuses to the list of acceptable statuses for Relevanssi. Add this to your site:

function rlv_add_status( $status_array ) {
    $status_array[] = 'new_status';
    return $status_array;
}
add_filter( 'relevanssi_valid_status', 'rlv_add_status' );
add_filter( 'relevanssi_valid_admin_status', 'rlv_add_status' );

This function, added to the two filters, makes Relevanssi accept the status new_status.

You also need to let search know that it’s ok to show these posts to users, using the relevanssi_post_ok filter hook:

add_filter( 'relevanssi_post_ok', 'rlv_allow_custom_status', 11, 2 );
function rlv_allow_custom_status( $post_ok, $post_id ) {
    $status = relevanssi_get_post_status( $post_id );
    if ( 'new_status' === $status ) {
      $post_ok = true;
    }
    return $post_ok;
}

With these functions, Relevanssi will now work with the status new_status.

Your account

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

Search

Popular Resources

Adding direct links to outside pages to search results

…__( ‘No Affiliate links found in Trash.’, ‘textdomain’ ), ‘archives’ => _x( ‘Affiliate link archives’, ‘The post type archive label used in nav menus. Default “Post Archives”. Added in 4.4′, ‘textdomain’ ), ‘filter_items_list’ => _x( ‘Filter Affiliate links list’, ‘Screen reader text for the filter links heading on the post……affiliatelink. The post type is private and doesn’t have any archives to it. It should be fairly invisible on the site, but it does appear in the admin dashboard and in Relevanssi indexing settings and can be searched. The way this post type is used is simple. Put the link……=> ‘affiliatelink’ ), ‘capability_type’ => ‘post’, ‘has_archive’ => false, ‘hierarchical’ => false, ‘menu_position’ => null, ‘supports’ => array( ‘title’, ‘editor’ ), ‘exclude_from_search’ => false, ); register_post_type( ‘affiliatelink’, $args ); } A large part of that is just the labels, but here we register a simple post type with the name…

Related Posts:

Comment Section:

4 Comments. Leave new

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