Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

GB Loop performance in Editor: possible to load only the first featured image?

  • Hi there,

    is there a way to configure the GB Query so that it only loads the first featured image of the posts in the editor in order to improve performance in the editor? A toggle for this would be great.

    When I think about it, a practical solution would be to use a toggle to override the ‘number of posts’ only in the editor display to 1. That should significantly improve editor performance.

    Thanks for your help.

    Kind regards, Claus

  • Hi there,

    We have a filter to only render 1 post, but no such filter to only render the image of the 1st post.

    If it’s ok for you to render 1 post in the ditor, give this code a try:

    add_filter('generateblocks_rest_get_wp_query_args', function($args, $props) {
        // Limit to 1 posts for backend preview
        $args['posts_per_page'] = 1;
        return $args;
    }, 10, 2);
  • Thanks, Ying. That’s exactly what I’m looking for. It would be really handy if you could activate it in the editor at runtime using a toggle – and deactivate it when you want to check all posts. How could that be implemented?

  • Hi Claus,

    Unfortunately, that’s not possible at the moment. Using the filter is the only available method.

  • Ok, I will use this filter. Thanks for your help!

  • You’re welcome!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.