Support » Plugin: WP Downgrade | Specific Core Version » It works after some editing

  • it would be perfect if it runs out of the box, however, it requires some code editing on my WordPress site(version:5.0.2) it may not works for everyone after I changed the code as it only applies to English WordPress site

    you should change the following code to make it works(
    The directory that the file located should be:/public_html/wp-content/plugins/wp-downgrade/wp-downgrade.php

    change the following code(Line 118-151):
    global $wp_version;
    // If current version is target version then stop
    if ( version_compare( $wp_version, $dg_version ) == 0 ) {
    return;
    } //https://downloads.wordpress.org/release/de_DE/wordpress-4.5.zip
    $updates->updates[0]->download = “https://wordpress.org/wordpress-“.$dg_version.”.zip”;
    $updates->updates[0]->packages->full = “https://wordpress.org/wordpress-“.$dg_version.”.zip”;
    $updates->updates[0]->packages->no_content = ”;
    $updates->updates[0]->packages->new_bundled = ”;
    $updates->updates[0]->current = $dg_version;

    return $updates;
    }

    function wpdg_urlcheck($url) {
    if (($url == ”) || ($url == null)) { return false; }
    $response = wp_remote_head( $url, array( ‘timeout’ => 5 ) );
    $accepted_status_codes = array( 200, 301, 302 );
    if ( ! is_wp_error( $response ) && in_array( wp_remote_retrieve_response_code( $response ), $accepted_status_codes ) ) {
    return true;
    }
    return false;
    }

    function wpdg_get_url($version) {
    $sprache = get_locale().’/’;
    if ($sprache == ‘en_US/’){
    $sprache = ”;
    };
    $url = “https://wordpress.org/wordpress-“.$version.”.zip”;
    return $url;
    }

    ?>

    • This topic was modified 4 months, 2 weeks ago by  jasonc123456.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Reisetiger

    (@reisetiger)

    Many thanks for the hint! You’re right, there was a bug with download URL for certain English versions. I have published an update. For many languages the URL should fit now. But from v1.2.0 you are now also able to edit the URL yourself, if necessary. I hope that helps in such cases, if an address changes again.

    Thanks for the quick updates for the plugin.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this review.