{"repo":"inpsyde/wp-context","free":true,"listed":false,"github":"https://github.com/inpsyde/wp-context","clone":"git clone https://github.com/inpsyde/wp-context.git","description":"A single-class utility to check the current request context in WordPress sites.","language":"PHP","stars":33,"topics":["wordpress","wordpress-development","hacktoberfest"],"license":"GPL-2.0","category":"self-hosted-apps","readme_excerpt":"WP Context A single-class utility to check the current request context in WordPress sites. --- --- How to use This is a Composer package, not a plugin, so first it needs to be installed via Composer. After that, assuming Composer autoload file is loaded, very early in the load process it is possible to instantiate the WpContext like this: The library does not implement singleton pattern, nor caches the retrieval of the current context, so it might be a good idea to save the created instance somewhere globally accessible in your plugin/theme/package/application. Having an instance of WpContext , it is possible to check the current context via its is method, or context-specific methods. For example: The method WpContext::is() is convenient to check multiple contexts, context-specific methods are probably better to check a single context. The full list of contexts that can be checked is: - - is(WpContext::CORE) / - isCore() - - is(WpContext::FRONTOFFICE) / - isFrontoffice() - - is(WpContext::BACKOFFICE) / - isBackoffice() - - is(WpContext::AJAX) / - isAjax() - - is(WpContext::LOGIN) / - isLogin() - - is(WpContext::REST) / - isRest() - - is(WpContext::CRON) / - isCron() - - is(WpContext::CLI) / - isWpCli() - - is(WpContext::XML RPC) / - isXmlRpc() - - is(WpContext::INSTALLING) / - isInstalling() - - is(WpContext::WP ACTIVATE) / - isWpActivate() About \"core\" and \"installing\" contexts WpContext::isCore() checks for the constants ABSPATH being defined, which means that it will norma","default_branch":null,"files":null,"tree":[],"storefront":"/r/inpsyde","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/inpsyde/wp-context/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}