• Resolved Malvyn

    (@insee77)


    Hi Dario,

    I’m using a theme that call the_excerpt() function on my homepage. And I noticed that your plugin causing a really slow down to my homepage (more than 5 seconds). This is because every time the_excerpt() function is being called, it also called the_content() function, so it triggers your plugin too. In my case there are 48 queries from your plugin.

    Here is a sample from query monitor reports:

    222 SELECT number_of_votes, sum_votes
    FROM wp_yasr_votes
    WHERE post_id=7712

    dynamic_sidebar(‘colormag_front_page_content_top_section’)
    wp-includes/widgets.php:742
    WP_Widget->display_callback()
    wp-includes/class-wp-widget.php:372
    colormag_default_news_widget->widget()
    wp-content/themes/v2/inc/widgets/widgets.php:1700
    the_excerpt()
    wp-includes/post-template.php:362
    get_the_excerpt()
    wp-includes/post-template.php:397
    apply_filters(‘get_the_excerpt’)
    wp-includes/plugin.php:203
    wp_trim_excerpt()
    wp-includes/formatting.php:3313
    apply_filters(‘the_content’)
    wp-includes/plugin.php:203
    yasr_add_schema()
    wp-content/plugins/yet-another-stars-rating/lib/yasr-functions.php:568
    yasr_get_visitor_votes()
    wp-content/plugins/yet-another-stars-rating/lib/yasr-db-functions.php:347

    120 SELECT vote
    FROM wp_yasr_log
    WHERE post_id=14992
    AND user_id=1
    ORDER BY id DESC
    LIMIT 1

    dynamic_sidebar(‘colormag_front_page_content_top_section’)
    wp-includes/widgets.php:742
    WP_Widget->display_callback()
    wp-includes/class-wp-widget.php:372
    colormag_default_news_widget->widget()
    wp-content/themes/v2/inc/widgets/widgets.php:1700
    the_excerpt()
    wp-includes/post-template.php:362
    get_the_excerpt()
    wp-includes/post-template.php:397
    apply_filters(‘get_the_excerpt’)
    wp-includes/plugin.php:203
    wp_trim_excerpt()
    wp-includes/formatting.php:3313
    apply_filters(‘the_content’)
    wp-includes/plugin.php:203
    do_shortcode()
    wp-includes/shortcodes.php:197
    preg_replace_callback()
    wp-includes/shortcodes.php:319
    do_shortcode_tag()
    wp-includes/shortcodes.php:319
    shortcode_visitor_votes_callback()
    wp-content/plugins/yet-another-stars-rating/lib/yasr-shortcode-functions.php:187
    yasr_check_if_user_already_voted()
    wp-content/plugins/yet-another-stars-rating/lib/yasr-db-functions.php:384

    There are 48 of queries like above on my homepage, despite the yasr was not being displayed. Please advise.

    Regards,

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Contributor dudo

    (@dudo)

    Hello Malvyn, you can disable Yasr for archive pages in the settings

    Thread Starter Malvyn

    (@insee77)

    Hello Dario,

    YASR for archive pages is disabled in the settings, but still there are queries from your plugin on the homepage.

    Here is the screenshot: https://imgur.com/a/QgDld

    Plugin Contributor dudo

    (@dudo)

    Sorry for the delay of this answer, I’ll look into this!

    Plugin Contributor dudo

    (@dudo)

    Ok, I confirm this and fix will be available on version 1.5.2

    Best,
    Dario

    Plugin Contributor dudo

    (@dudo)

    Hello @insee77, can you try again with version 1.5.2?

    Best,
    Dario

    Thread Starter Malvyn

    (@insee77)

    Hi Dario,

    I’ve tested with version 1.5.2 and 1.5.3 but then I could not make visitors vote works. May be there’s a AJAX/javascript (rateit?) conflict within my site. When a visitor click the stars, it disapeared and vote didn’t saved into database.

    So I revert to version 1.4.9 and use yasr-functions.php from ver 1.5.3. I confirm that there are no more YASR queries on my homepage and archive pages. Thank you.

    Regards,

    Thread Starter Malvyn

    (@insee77)

    Btw, is there any plan that YASR will supports AMP? Most of my visitors came from Google AMP cache. It would be nice if visitor can also vote within AMP article directly.

    Plugin Contributor dudo

    (@dudo)

    Hello Malvyn:

    if you revert to version 1.4.9 the queries should be there again.
    instead, it’s pretty strange that error to version 1.5.3.

    Can you please share a link so that I can look into it?

    About AMP: this is not possibile, simply because jquery doesn’t work on AMP pages ??

    Best,
    Dario

    Thread Starter Malvyn

    (@insee77)

    Hi Dario,

    if(!is_singular() && is_main_query() || is_404()){
                return $content;
            }

    in yasr_add_schema function to stop the queries on homepage and archive pages, am I correct?

    Plugin Contributor dudo

    (@dudo)

    Yes, and I’ve added a similar code in the shortcodes function too

    Thread Starter Malvyn

    (@insee77)

    About AMP: this is not possibile, simply because jquery doesn’t work on AMP pages ??

    How about using this AMP HTML component: https://ampbyexample.com/advanced/star_rating/ ?

    Plugin Contributor dudo

    (@dudo)

    I’ll take a look into it, thank you for your suggestion!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Plugin triggered by the_excerpt() function and slowing down my homepage’ is closed to new replies.