Skip to content

Instantly share code, notes, and snippets.

@juanmaguitar
Created November 5, 2025 09:56
Show Gist options
  • Select an option

  • Save juanmaguitar/a7f4927d264519637f3946f2427349c4 to your computer and use it in GitHub Desktop.

Select an option

Save juanmaguitar/a7f4927d264519637f3946f2427349c4 to your computer and use it in GitHub Desktop.
⬢  wp shell

wp> foreach ( wp_get_abilities() as $a ) echo $a->get_name() . "\n";

  core/get-site-info
  core/get-environment-info
  site/site-info
  list-all-urls/urls

wp> $ability = wp_get_ability('core/get-environment-info');

  => object(WP_Ability)#2807 (9) {
    ["name":protected] => string(25) "core/get-environment-info"
    ...
  }

wp> wp_set_current_user( 1 ); // Set to an admin user ID

  => object(WP_User)#2823 (8) {
    ["data"]=>
    object(stdClass)#2760 (10) {
      ["ID"]=>
      string(1) "1"
      ["user_login"]=>
      string(5) "admin"
      ...
    }
    ...
  }

wp> $ability->execute()

  => array(4) {
    ["environment"]=>
    string(10) "production"
    ["php_version"]=>
    string(5) "8.4.7"
    ["db_server_info"]=>
    string(6) "3.50.4"
    ["wp_version"]=>
    string(9) "6.9-beta2"
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment