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

wp cli - Is it possible to view WP documentation within the WordPress shell?

programmeradmin2浏览0评论

I'm having trouble navigating the WP documentation so forgive me if this is common knowledge.

Is it possible to view the documentation of classes and methods from within the shell?

That is, is there a command that I can type at the wp-shell prompt that will return the api documentation for a given method/class.

Something like:

doc(get_posts);
#=> get_posts( array $args = null )
# Retrieves an array of the latest posts, or posts matching the given criteria.
# Parameters
# $args
# ...

For example, pry-doc in Ruby provides something similar.

I'm having trouble navigating the WP documentation so forgive me if this is common knowledge.

Is it possible to view the documentation of classes and methods from within the shell?

That is, is there a command that I can type at the wp-shell prompt that will return the api documentation for a given method/class.

Something like:

doc(get_posts);
#=> get_posts( array $args = null )
# Retrieves an array of the latest posts, or posts matching the given criteria.
# Parameters
# $args
# ...

For example, pry-doc in Ruby provides something similar.

Share Improve this question edited May 17, 2019 at 9:02 user3574603 asked May 17, 2019 at 8:32 user3574603user3574603 3411 gold badge2 silver badges11 bronze badges 3
  • I'm afraid I don't understand your question. Which documentation? What shell? – cjbj Commented May 17, 2019 at 8:44
  • I've updated my question to be more explicit. – user3574603 Commented May 17, 2019 at 8:53
  • 1 I guess in theory one could create a custom wp-cli command/function with wp_remote_get() on e.g. developer.wordpress, then parse it with e.g. DomDocument and hope the HTML is well structured and similar across the pages :-) It would be an interesting idea to have developer.wordpress available in other formats than HTML. I haven't checked though. – birgire Commented May 17, 2019 at 10:33
Add a comment  | 

2 Answers 2

Reset to default 1

Skimming the available WP-CLI commands I guess there is not something like that. You may create a feature request in the WP-CLI GitHub repo but I doubt that this will gain much attention without you explaining the actual necessity of such command.

Normally when developing, you use your IDE to get hold of those information. A good IDE provides you autocompletion, type hints or shortcuts that let you jump into certain core functions.

Naming PhpStorm as an example which has built-in WordPress support it looks like this when I just start to type wp_:

You could try WP-CLI Reference Command. This is neither an official command, nor can it be used inside wp shell, but will be helpful to you in getting hook / function information from command line.

发布评论

评论列表(0)

  1. 暂无评论