[Resolved] Show posts with custom post status in views
This thread is resolved. Here is a description of the problem and solution.
Problem:
Search for posts with custom post status in views not working Solution:
I checked it and the issue was with the third filter: Filter by post relationship or repeatable fields group owner.
With it disabled, the filter by status was working fine.
I checked it and it seems like the Owner participates of two different relationships. By selecting the only one relationship, it somehow was impacting with the status filter.
I changed it slightly, updating it to check if the current item in the loop has any relationship with the current owner.
I'll try to explain my issue in the best possible way!
I have used a plugin (called Extended Post Status) to create a Custom Post Status (the new status is "Archive")
When I use a View to retrieve all posts (including the "Archive" ones) everything shows up as expected!
I have also created another View - using some filters:
I display Posts that are Related to another Post, the author of which, in the same as the current logged in user.
Again this view shows everything fine (even draft, pending, password protected posts) APART from the "Archive" ones.
There is an internal filter that controls the accepted post statuses, you could try adding the following code (e.g. at Toolset > Settings > Custom Code) and see if that works:
add_filter( 'toolset_accepted_post_statuses_for_api', function($stati){
$extra_statuses = array( 'archive' ); // array of the extra post status slugs you want to add
return array_merge( $stati, $extra_statuses );
});
I'm not sure the case would impact, but it seems like the status was created with the capital A. Just as a test, can you please change the code looking for the post status 'Archive' to see if it causes any changes?
If not, I would like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.
Our Debugging Procedures
I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.
- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link
Please, let me know if you need any additional details. Have a nice day.
I checked it and the issue was with the third filter: Filter by post relationship or repeatable fields group owner.
With it disabled, the filter by status was working fine.
I checked it and it seems like the Owner participates of two different relationships, Male and Female. By selecting the Female relationship, it somehow was impacting with the status filter.
I changed it slightly, updating it to check if the current item in the loop has any relationship with the current owner.