最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugin development - Is there such a thing as a WordPress console?

programmeradmin1浏览0评论

I'm learning how to develop WP plugins.

I would like to try calling some methods to see what they return. It would be great if I could do so in the console instead of writing tests or log messages.

Is there such a thing as a Wordpress console? That is, I'd like to log in to WP in the terminal and call methods directly.

I'm learning how to develop WP plugins.

I would like to try calling some methods to see what they return. It would be great if I could do so in the console instead of writing tests or log messages.

Is there such a thing as a Wordpress console? That is, I'd like to log in to WP in the terminal and call methods directly.

Share Improve this question asked May 16, 2019 at 21:28 user3574603user3574603 3411 gold badge2 silver badges11 bronze badges 2
  • 1 There's the WP-CLI but this won't allow you to access plugin functions unless the plugin is setup to work with the CLI. – Alexander Holsgrove Commented May 16, 2019 at 21:30
  • Thanks. I see the CLI provides wp shell which is what I need. – user3574603 Commented May 16, 2019 at 21:44
Add a comment  | 

1 Answer 1

Reset to default -1

If you want to see notices/messages in the admin area, try 'Admin Notices' . See https://codex.wordpress/Plugin_API/Action_Reference/admin_notices .

A good tutorial is here: https://www.wpbeginner/wp-tutorials/how-to-add-admin-notices-in-wordpress/.

I recommend setting the 'is_dismissable' class in the HTML of the message you want to display. That will allow you to close/exit the notice.

发布评论

评论列表(0)

  1. 暂无评论