{"id":26,"date":"2012-11-10T00:00:00","date_gmt":"2012-11-10T00:00:00","guid":{"rendered":"https:\/\/make.wordpress.org\/cli\/2012\/11\/10\/wp-shell\/"},"modified":"2012-11-10T00:00:00","modified_gmt":"2012-11-10T00:00:00","slug":"wp-shell","status":"publish","type":"post","link":"https:\/\/make.wordpress.org\/cli\/2012\/11\/10\/wp-shell\/","title":{"rendered":"Interactive WordPress Debugging"},"content":{"rendered":"<p>A new command <a href=\"https:\/\/github.com\/wp-cli\/wp-cli\/pull\/89\">landed<\/a> in <span tabindex='0' class='glossary-item-container'>WP-CLI<span class='glossary-item-hidden-content'><span class='glossary-item-header'>WP-CLI<\/span> <span class='glossary-item-description'>WP-CLI is the Command Line Interface for WordPress, used to do administrative and development tasks in a programmatic way. The project page is <a href=\"http:\/\/wp-cli.org\/\">http:\/\/wp-cli.org\/<\/a> <a href=\"https:\/\/make.wordpress.org\/cli\/\">https:\/\/make.wordpress.org\/cli\/<\/a><\/span><\/span><\/span> a few days ago, called <code>shell<\/code>. It was inspired by an older project called <a href=\"https:\/\/code.trac.wordpress.org\/browser\/wpshell\">wpshell<\/a>.<\/p>\n<p>When you run <code>wp shell<\/code>, a <acronym title=\"read-eval-print-loop\">REPL<\/acronym> will start, in which you can run any WordPress function.<\/p>\n<p>The major advantage over <code>wp eval<\/code> and <code>wp eval-file<\/code> is that it\u2019s interactive: you immediately see the result of the previous command; it\u2019s also stored in the special <code>$_<\/code> variable, which you can use in the next command and so on.<\/p>\n<p>Here\u2019s a contrived example session:<\/p>\n<pre><code>scribu@air:~\/wp\/core$ wp shell\nType \"exit\" to close session.\nwp&gt; get_bloginfo('wpurl')\n'http:\/\/wp.dev\/core'\nwp&gt; $_ . '\/feed\/'\n'http:\/\/wp.dev\/core\/feed\/'\nwp&gt; exit\nscribu@air:~\/wp\/core$\n<\/code><\/pre>\n<p><code>wp shell<\/code> will be available in the 0.7 release of WP-CLI, but if you want to try it out right now, clone the <a href=\"https:\/\/github.com\/wp-cli\/wp-cli\">latest version<\/a> from <span tabindex='0' class='glossary-item-container'>github<span class='glossary-item-hidden-content'><span class='glossary-item-header'>GitHub<\/span> <span class='glossary-item-description'>GitHub is a website that offers online implementation of git repositories that can easily be shared, copied and modified by other developers. Public repositories are free to host, private repositories require a paid subscription. GitHub introduced the concept of the \u2018pull request\u2019 where code changes done in branches by contributors can be reviewed and discussed before being merged by the repository owner. <a href=\"https:\/\/github.com\/\">https:\/\/github.com\/<\/a><\/span><\/span><\/span>. If you have suggestions for making it better, don\u2019t hesitate to open issues and pull requests.<\/p>\n<nav class='o2-post-footer-actions'><ul class='o2-post-footer-action-row'><li class='o2-post-footer-action'><a href=\"https:\/\/login.wordpress.org\/?redirect_to=https%3A%2F%2Fmake.wordpress.org%2Fcli%2F2012%2F11%2F10%2Fwp-shell%2F%23respond&#038;locale=en_US\" title=\"Login to Reply\"  class=\"genericon  genericon-reply\"  data-action=\"login-to-reply\"  data-actionstate=\"default\" >Login to Reply<\/a><\/li><\/ul><div class='o2-post-footer-action-likes'><\/div><ul class='o2-post-footer-action-row'><\/ul><\/nav>","protected":false},"excerpt":{"rendered":"<p>A new command landed in WP-CLIWP-CLI WP-CLI is the Command Line Interface for WordPress, used to do administrative and development tasks in a programmatic way. The project page is http:\/\/wp-cli.org\/ https:\/\/make.wordpress.org\/cli\/ a few days ago, called shell. It was inspired by an older project called wpshell. When you run wp shell, a REPL will start, [&hellip;]<\/p>\n","protected":false},"author":180901,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-26","post","type-post","status-publish","format-standard","hentry","category-uncategorized","author-scribu"],"revision_note":"","jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8f6uR-q","_links":{"self":[{"href":"https:\/\/make.wordpress.org\/cli\/wp-json\/wp\/v2\/posts\/26","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/make.wordpress.org\/cli\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/make.wordpress.org\/cli\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/make.wordpress.org\/cli\/wp-json\/wp\/v2\/comments?post=26"}],"version-history":[{"count":0,"href":"https:\/\/make.wordpress.org\/cli\/wp-json\/wp\/v2\/posts\/26\/revisions"}],"author":[{"embeddable":true,"href":"https:\/\/make.wordpress.org\/cli\/wp-json\/wporg\/v1\/users\/scribu"}],"wp:attachment":[{"href":"https:\/\/make.wordpress.org\/cli\/wp-json\/wp\/v2\/media?parent=26"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/make.wordpress.org\/cli\/wp-json\/wp\/v2\/categories?post=26"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/make.wordpress.org\/cli\/wp-json\/wp\/v2\/tags?post=26"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}