Support

Account

Home Forums Backend Issues (wp-admin) Not all items are listed in the custom content listing in the backend.

Solved

Not all items are listed in the custom content listing in the backend.

  • Hi there,

    I am working on a new website on my local machine and I am using ACF for custom content for a basic “Events” feature.

    Just for testing end development I have created two “Event” items and I have noticed twice now that all of a sudden the listing in the backend only shows one item while above the listing the amount of “All” and “Published” is still two. Meaning I can not access one of the items via the backend any more.

    The first time I noticed this I accessed the missing item via the frontend, trashed it and then cleaned the database with “WP DB Cleaner”. I assumed this fixed the issue but now it happened again.

    Cleaning the database without first trashing the missing item does not seem to work.

    I also tried deactivating all other plugins without success.

    The PHP log does not seem to have an error related to this.

    Now I am concerned this might happen when the new site is live so I am trying to figure out why this happens and how I can prevent this?

    Anyone?

  • My apologies, this was not related to ACF. Richt after I posted this question I figured out it was a script in my child theme doing this. I have a script that is supposed to show only the upcoming events on the “Events” archive page. It was also affecting the listing in the backend. I fixed it by adding “&& !is_admin()” in the condition.

    It might come in handy for someone else. This is the script I’m talking about:

    
    function filter_event_archive_query($query)
    {
        if (is_post_type_archive('event') && $query->is_main_query() && !is_admin()) {
            $meta_query = array(
                array(
                    'key' => 'start_date_time',
                    'value' => date('Y-m-d H:i:s'),
                    'compare' => '>=',
                    'type' => 'DATETIME'
                )
            );
            $query->set('meta_query', $meta_query);
            $query->set('orderby', 'meta_value');
            $query->set('order', 'ASC');
        }
    }
    add_action('pre_get_posts', 'filter_event_archive_query');
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.