• Hello,

    I have a CPT that is giving me memory issues in the admin panel. It has 30,000 posts in it and the select statement takes about 2 seconds to return data. But when I look at the select it does a “select *” to view the lists of posts without a limit. Is there a way to exclude the post_content column to reduce the size of the query?

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • How is the CPT defined? Is there possibly also individual programming that sends these statements? Because using WP_Query would not result in such a statement.

    I remember facing a similar issue, in my case, a hierarchical post type was involved. And memory was running out while rendering the post table.

    WP adds “Parent” dropdowns for quick edit/bulk edit actions for a hierarchical post type. This dropdown lists all the posts (from that post type) which caused high resource usage.

    The way I fixed the issue was using quick_edit_dropdown_pages_args filter. It allows you to limit the number of posts returned for the dropdown:

    function limit_quick_edit_parent_dropdown_options($args)
    {
        if ('my-cpt' === $args['post_type']) {
            $args['number'] = 1;
        }
    
        return $args;
    }
    add_filter('quick_edit_dropdown_pages_args', 'limit_quick_edit_parent_dropdown_options', 10);
    

    Don’t set$args['number'] to 0 as that will include all the posts (default value). I haven’t checked if there is a new, or a better way to resolve this.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘WordPress Memory Issue’ is closed to new replies.