Remove unnecessary query from global blocks.

Posted in: Newspaper
Post count: 22

Each time we use a global block – eg: a text or a social media icon – we can see an unrelated SQL query fetching the most recent 5 posts.

Query Monitor helps to find that they all have in common to be extended from the global block class.

wp-content/plugins/td-composer/legacy/common/wp_booster/td_global_blocks.php:27

Query below:
SELECT SQL_CALC_FOUND_ROWS wp_posts.ID
FROM wp_posts
WHERE 1=1
AND wp_posts.post_type = 'post'
AND ((wp_posts.post_status = 'publish'))
ORDER BY wp_posts.post_date DESC
LIMIT 0, 5

Please help to find how to disable this query.
As a workaround, we tend to use RAW HTML block but it’s not super convenient!

Thanks!!

Post count: 18283

Hello !

After some investigations for these queries and these are not from Newspaper Theme. They are from WordPress
-> https://i.imgur.com/VLk8Ye8.png -> https://i.imgur.com/3ppn11T.png -> https://i.imgur.com/NxlIFTa.png -> https://i.imgur.com/YOJBr2P.png
-> https://www.screencast.com/t/hYrDlUEtsho

This is a general limitation of WordPress, and not the theme so any modification to the actual query has to be made on the WordPress level.

I hope this was helpful !

Thank you !

Post count: 22

Hi Vlad,

Thanks for investigating this.
I reviewed the screen capture you provided but they do not match the queries we see.

Below is the call stack when adding a Multipurpose Shortcode “Inline Text”, which triggers the MySQL request I shared above.
I can reproduce this with a fresh install on Newspaper with a new WordPress.
Can you see it too?

WP_Query->get_posts()
wp-includes/class-wp-query.php:2994
WP_Query->query()
wp-includes/class-wp-query.php:3413
WP_Query->__construct()
wp-includes/class-wp-query.php:3522
td_data_source::get_wp_query()
wp-content/plugins/td-composer/legacy/common/wp_booster/td_data_source.php:410
td_block->render()
wp-content/plugins/td-composer/legacy/common/wp_booster/td_block.php:131
tdm_block_inline_text->render()
wp-content/plugins/td-composer/td-multi-purpose/shortcodes/tdm_block_inline_text.php:68
td_global_blocks::proxy_function()
wp-content/plugins/td-composer/legacy/common/wp_booster/td_global_blocks.php:27
do_shortcode_tag()
wp-includes/shortcodes.php:325
preg_replace_callback()
wp-includes/shortcodes.php:325
do_shortcode()
wp-includes/shortcodes.php:199
tdc_composer_block->do_shortcode()
wp-content/plugins/td-composer/includes/tdc_composer_block.php:198
vc_column->render()
wp-content/plugins/td-composer/includes/shortcodes/vc_column.php:119
td_global_blocks::proxy_function()
wp-content/plugins/td-composer/legacy/common/wp_booster/td_global_blocks.php:27
do_shortcode_tag()
wp-includes/shortcodes.php:325
preg_replace_callback()
wp-includes/shortcodes.php:325
do_shortcode()
wp-includes/shortcodes.php:199
tdc_composer_block->do_shortcode()
wp-content/plugins/td-composer/includes/tdc_composer_block.php:198
vc_row->render()
wp-content/plugins/td-composer/includes/shortcodes/vc_row.php:766
td_global_blocks::proxy_function()
wp-content/plugins/td-composer/legacy/common/wp_booster/td_global_blocks.php:27
do_shortcode_tag()
wp-includes/shortcodes.php:325
preg_replace_callback()
wp-includes/shortcodes.php:325
do_shortcode()
wp-includes/shortcodes.php:199
tdc_composer_block->do_shortcode()
wp-content/plugins/td-composer/includes/tdc_composer_block.php:198
tdc_zone->render()
wp-content/plugins/td-composer/includes/shortcodes/tdc_zone.php:576
td_global_blocks::proxy_function()
wp-content/plugins/td-composer/legacy/common/wp_booster/td_global_blocks.php:27
do_shortcode_tag()
wp-includes/shortcodes.php:325
preg_replace_callback()
wp-includes/shortcodes.php:325
do_shortcode()
wp-includes/shortcodes.php:199
apply_filters('the_content')
wp-includes/plugin.php:206
the_content()
wp-includes/post-template.php:253

Post count: 18283

Hello !

Please contact us via email at contact@tagdiv.com and provide the following:

– admin url and credentials
– cPanel url and credentials
– A link to this topic in order to identify you

Our team will take a look !

Thank you !

Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newspaper’ is closed to new topics and replies.