WordPress.org

Ready to get started?Download WordPress

Forums

WordPress HTTPS (SSL)
Caching url parts (1 post)

  1. Sensus-method
    Member
    Posted 5 months ago #

    Since my custom plugin is generating a lot of hyperlinks to other wordpress pages, the site is getting slow.
    After some research, this HTTPS plugin was the bottleneck.
    300+ mysql statements for retrieving the post id

    therefore I would suggest a slight modification for WordPressHTTPS_Module_Parser::fixLinksAndForms() to add some kind of caching

    Append after:

    global $wpdb;
    static $cachedUrlParts=array();

    Change:

    } else if ( isset($url_parts['path']) && ($post = get_page_by_path($url_parts['path'])) ) {

    Into:

    } elseif ( isset($url_parts['path']) ){
    if( isset( $cachedUrlParts[ $url_parts['path'] ] ) ){
    $post_id = $cachedUrlParts[ $url_parts['path'] ];
    }elseif($post = get_page_by_path($url_parts['path']) ) {
    $post_id = $post->ID;
    }
    $cachedUrlParts[ $url_parts['path'] ]= $post_id;
    }

    https://wordpress.org/plugins/wordpress-https/

Reply

You must log in to post.

About this Plugin

About this Topic