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

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.

Topic wp-cli documentation Wordpress

Category Web


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.


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_:

enter image description here

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.