• 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/

  • The topic ‘Caching url parts’ is closed to new replies.