• Resolved Robert O’Rourke

    (@sanchothefat)


    Hi, I found the following code:

    $set = get_option( 'post_type_rules_flushed_mapster_wp_maps' );
    if ( $set !== true ) {
    flush_rewrite_rules( false );
    update_option( 'post_type_rules_flushed_mapster_wp_maps', true );
    }

    $set will never be exactly equal to true because WP stores and returns it as the string "1" per https://developer.ww.wp.xz.cn/reference/functions/get_option/

    Flushing the rewrite rules is an expensive operation, and the following update_option() call isn’t ideal either – really there should no be no database updates happening on a frontend request whenever it can be avoided because a spike in traffic could easily tie up resources and even take down a website.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author mapster

    (@mapster)

    Hello Robert, thank you very much for this note. I’ve jumped in and taken a look and you are 100% right, I made a mistake here with setting and checking for true. I’ve taken a quick look across the rest of the plugin and this is the only place I explicitly check for true — most of the time I’m just checking to see if an option is set at all. Anyway, I’ve updated this in my latest beta version.

    If you’d like to do a test with that beta version and confirm I have it all working as you’d like, email me at [email protected]. Otherwise, I should release a fixed version within the next few hours.

    Thanks so much again for the detailed and precise report!

    Plugin Author mapster

    (@mapster)

    Issue should now be resolved in 1.12.0.

    Thread Starter Robert O’Rourke

    (@sanchothefat)

    @mapster easily done, it’s an annoying quirk of WP. Amazing turnaround on the resolution – thanks for that! Our clients are loving the plugin 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Performance issue – displaying a map causes several database updates’ is closed to new replies.