WordPress.org

Forums

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

  1. Sensus-method
    Member
    Posted 1 year 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/

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WordPress HTTPS (SSL)
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic