If you are displaying the info in the front-end, hook into wp
or init
, otherwise init
or admin_init
will work on admin:
add_action('wp', function() {
if( current_user_can("manage_options") && ! is_feed() && isset( $_GET["my_plugin_show_phpinfo"] ) ) {
?>
<!-- Output things -->
<?php phpinfo(); ?>
<?php
exit;
}
});
Now if you go to http://example.com/?my_plugin_show_phpinfo=1
it will display your custom content only. Hope that helps.
Edit: Added conditional to limit the tab for admins only. Thanks TomC!
Related Posts:
- Should I use spl_autoload_register() in my plugin?
- How can I save a multiple select array with the settings API for a plug-in options page?
- Include WP_Query in my own PHP file?
- Using register_activation_hook in classes
- Is there a way for a plugin to add an attribute to the tag of a theme?
- How to use update and delete query in wordpress
- Gutenberg Blocks doesn’t render correctly when using do_blocks
- add_meta_boxes action with refresh on save
- Resize Image without cropping
- My shortcode is showing up twice
- Database “Migration” for Plugins?
- Does wp-cron runs all tasks scheduled at same time together or one after other?
- Making Quote Plugin more efficient
- Hiding WordPress Plugin Source Code
- How do I use the Simple HTML DOM Parser in plugin when other plugin already uses it?
- Will simple function names in a class structure conflict with other plugins?
- Instantiate class to be available to all plugin functions
- How to test nonce with AJAX – Plugin development
- wp_loaded hook block script enquequing
- WP nonce invalid
- How can i upload images in an admin page?
- How to find error in my code when the error message is pointing to WP core file?
- How to access global variable $menu inside a class function
- How to set up VS Code for WP plugin/theme development in 2021? [closed]
- Custom user login page by creating a plugin
- Singelton class does not work, multiple initialization on page reload
- Saving an array of dynamic repeater data as post_meta
- How to upload a file to a folder named after the user_id via plugin
- developing a wordpress plugin, have a few PHP Woocommerce related coding questions
- Improve page speed loading using CDN and async or defer attribute
- Whitelisting items from custom options page
- Add_menu_page not displaying the menu in class based plugin
- adjust section according to country?
- PHP > Scheduled Tasks > Sending daily email with dynamic API variables
- “Undefined index” error when saving empty array with checkboxes
- What exactly do this function declared into functions.php file of a WP theme?
- How to use html inside a functions.php code?
- WordPress Environment: Dynamic Page using shortcode – how to change the page name for sharing
- Extend Woocommerce Widget Class – WC_Widget_Product_Categories
- plugin add action hook is not working :
- zip unzip attachments in wordpress
- wordpress admin plugin menu custom css
- How to Change CSS Colors from Custom Plugin Settings Page
- Passing the name of selected color from the custom component to `render_callback`
- Any ideas why I am getting “I’m getting “wp-admin/admin-ajax.php 401 (Unauthorized)”
- Cant register rest routs from class instance
- how to Update 15k products on plugin activation with meta_option
- Hooks for post saving make a post-new.php to load latest post’s data
- Adding Additional Variables on Menus Page
- Using flickr api in custom wordpress plugin
- Toolbar Hidden in a Virtual Page
- select a single val though a table in wordpress
- PHP: $_SESSION destroyed after page reload for my custom session
- How to correctly escape an echo
- Problem with inserting multiple images in gallery of each WooCommerce product programmatically
- Is it possible to access admin-ajax.php using PHP?
- Payment field disappears on custom Paypal plugin
- Call to “admin_notices” hook from a static method
- Adding image upload in tag section – WordPress plugin development
- How to Remove Theme Style CSS inside Custom Plugin?
- Creating plugin with front-end pages
- How to Send Pingbacks for all Posts in WordPress?
- Reliable way to add nonce to HTTP Header in WordPress?
- I am having errors with checkout on wordpress
- ssl redirect function is not working
- How can I update the price when someone enters postcode or zip code in woocommerce checkout page?
- 400 bad request admin-ajax file upload
- get Woocommerce product format json for WP_Query
- Gutenberg blocks shortcodes compatibility
- Save custom field on WP_List_Table
- Load script and styles using an array of resources
- Update user meta when an external link in admin notice is clicked
- Is there an option to execute javascript file only on plugin activation
- How do I remove an action hook inside a class that is called by another class?
- The plugin generated 225 characters of unexpected output during activation
- Ajax in a class instantiated via shortcode
- Parsing webhook from Shopify in WordPress
- Shortcode Works for Logged in Users but Not Working for Guest
- Submit to itself don’t work
- WordPress / PhpStorm / XDebug and plugin_dir_path issues
- Unable to pass variable to database
- Send data from plugin to external database
- Add custom filter to register data in array
- See output of a sql query while plugin installation in wordpress
- Why this plugin is not working?
- Permission error on plugin save
- Trouble using wordpress functions in a pop-up modal form
- How to execute add_action() function from custom plugin to Crontrol plugin or do_action()?
- MySQL update text field with ‘
- how can I make content from a plugin hidden when user is logged in? [duplicate]
- base64_encode conflict with convert_smilies in wordpress
- Properly process a custom WP REST API request (Authenticate, Authorize + Validate)?
- Implement OAuth2 in custom plugin
- login redirect based on user role not work as expected
- redirect user from login page if is logged
- How to pass and validate nonce in custom REST routes
- How to lock users account until approvation
- Variable ++ in query loop
- ajax problems on loading page [closed]
- WordPress REST API – Custom field not added to pages