1

I need to find out where/how I can access the plugin updates in a WordPress siteenter image description here

Ideally I want to have these in a json format, with the entire list of plugin updates available.

TIA

1 Answer 1

2

Plugin update data is cached in the update_plugins site transient with available updates under the response property.

$data = get_site_transient( 'update_plugins' );
var_dump( $data->response );

Response looks a bit like:

array(1) {
  ["wordpress-seo/wp-seo.php"]=>
  object(stdClass)#1873 (11) {
    ["id"]=>
    string(27) "w.org/plugins/wordpress-seo"
    ["slug"]=>
    string(13) "wordpress-seo"
    ["plugin"]=>
    string(24) "wordpress-seo/wp-seo.php"
    ["new_version"]=>
    string(5) "5.5.1"
    ["url"]=>
    string(44) "https://wordpress.org/plugins/wordpress-seo/"
    ["package"]=>
    string(62) "https://downloads.wordpress.org/plugin/wordpress-seo.5.5.1.zip"
    ["icons"]=>
    array(4) {
      ["1x"]=>
      string(66) "https://ps.w.org/wordpress-seo/assets/icon-128x128.png?rev=1550389"
      ["2x"]=>
      string(66) "https://ps.w.org/wordpress-seo/assets/icon-256x256.png?rev=1550389"
      ["svg"]=>
      string(58) "https://ps.w.org/wordpress-seo/assets/icon.svg?rev=1203032"
      ["default"]=>
      string(58) "https://ps.w.org/wordpress-seo/assets/icon.svg?rev=1203032"
    }
    ["banners"]=>
    array(3) {
      ["2x"]=>
      string(69) "https://ps.w.org/wordpress-seo/assets/banner-1544x500.png?rev=1695112"
      ["1x"]=>
      string(68) "https://ps.w.org/wordpress-seo/assets/banner-772x250.png?rev=1695112"
      ["default"]=>
      string(69) "https://ps.w.org/wordpress-seo/assets/banner-1544x500.png?rev=1695112"
    }
    ["banners_rtl"]=>
    array(3) {
      ["2x"]=>
      string(73) "https://ps.w.org/wordpress-seo/assets/banner-1544x500-rtl.png?rev=1695112"
      ["1x"]=>
      string(72) "https://ps.w.org/wordpress-seo/assets/banner-772x250-rtl.png?rev=1695112"
      ["default"]=>
      string(73) "https://ps.w.org/wordpress-seo/assets/banner-1544x500-rtl.png?rev=1695112"
    }
    ["tested"]=>
    string(5) "4.8.2"
    ["compatibility"]=>
    object(stdClass)#1846 (0) {
    }
  }
}

Data is generated from from the dot-org plugin update check endpoint (some limited documentation) and is fetched in the wp_update_plugins() function.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.