Skip to content

Instantly share code, notes, and snippets.

@kingkool68
Last active September 21, 2017 21:57

Revisions

  1. kingkool68 revised this gist Jan 4, 2017. No changes.
  2. kingkool68 renamed this gist Jan 4, 2017. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. kingkool68 created this gist Jan 2, 2017.
    11 changes: 11 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    /*
    Here we're filtering the site_url() and get_site_url() functions which are called dozens and dozens of times during a request.
    In this case we only want to modify $url if the filter was called from a particular PHP class (rtCamp\WP\Nginx\Helper)
    */
    add_filter( 'site_url', function( $url = '' ) {
    $backtrace = wp_debug_backtrace_summary();
    if ( stripos( $backtrace, 'rtCamp\WP\Nginx\Helper' ) ) {
    $url = str_replace( 'https://', 'http://', $url );
    }
    return $url;
    });