Skip Navigation

[Resolved] Views produce an extra blank output of the records from the archive

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 1 voice and has 0 replies.

>
Author
Posts
#2680299
2024-01-27_20-29-23.png

I am trying to:

Set up a page where users can view their own posts

Link to a page where the issue can be seen:

hidden link

I expected to see:

A single record formatted according to the content template

Instead, I got:

The desired record and an extra, blank record (contains labels but no data from the configured Text and Fields content)

#2680336

It turned out the issue was caused by a code snippet (provided and recommended in a Toolset tech support ticket - https://toolset.com/forums/topic/list-custom-post-types-posts-on-author-page/). I had modified the code to support 2 CPTs as below.

is_author)
// Add 'invitations' CPT and 'guides' CPT and the default 'posts' to display in author's archive
$query->set( 'post_type', array('invitations', 'posts', 'guides') );
remove_action( 'pre_get_posts', 'custom_post_author_archive' );
}
add_action('pre_get_posts', 'post_types_author_archives');

?>

This caused the duplicate blank record to appear. I have disabled the custom code and the View loop is producing the correct output now.