To only insert code into the header section in the admin area on single plugin pages you need to alter your add_action()
function.
add_action('admin_head-pageof_thisplugin/thisplugin', 'thisplugin_adminhead');
function thisplugin_adminhead() {
// here goes your content
echo '<script>'
.'/* ... */'
.'</script>';
}
where pageof_thisplugin/thisplugin
is the hook slug that returns out of the function that creates your page like add_submenu_page()
, add_options_pageor
add_management_page`.
Source and further details in the WordPress Codex
Related Posts:
- Update plugin from personal API
- Loading external page template and enqueue script from plugin causes 403 forbidden error
- Symlinked plugin directory doesn’t appear in Admin
- Where the Nickname is being used in WordPress
- Is their any way to Extend WPDB class and Overwrite the Default Query Function
- How do I only load a plugin js on it’s settings pages?
- How can I include a setting that has a variable number of values in a settings page using register_setting?
- Adding dynamic section to WordPress
- Use functionality of 2 wordpress plugins
- Custom data-id wp_enqueue_script
- Yoast SEO blocking/re-initialising longer running process
- Add Fields with Sub-Fields to WP Job Manager
- template_redirect not being called when using ajax
- Can WordPress plugins “Talk to each other”?
- How use %like% in sql statement wordpress
- Can I use a form in a dashboard widget?
- Is there a way to alter the order in which the plugins appear in the page?
- How to correctly detect accessing wp-content/uploads?
- How to create custom embed block in gutenberg wordpress
- Plugin exceeds memory limit
- How can sanitize $_FILES[‘haq_slider’] field
- How to trigger $_GET request within admin plugin page?
- How to ‘clone’ a wp plugin to make small changes
- MITM risk of not sanitizing?
- Get IDs of Images from Gallery Block in InnerBlocks of a Custom Gutenberg Block
- WordPress plugin – Error “Plugin generate 2890 characters of unexpected output when activated”
- Woocommerce plugin for minimum order and add-to-card-step
- Change plugin main file name (that is currently in the repo)
- Edit Yoast SEO breadcrumbs output [closed]
- Using a post-signup hook to get user details
- How to apply a patch via plugin?
- Is there any kind of theme on WordPress to sell my own movies?
- wp_remote_get() returns 403 while file_get_contents() does not
- How to set add question capability for author role in wp pro quiz plugin
- Suggestions on Approach to New Plugin I’m Stuck On
- How to redirect users to their profile after they successfully edit their profile
- Unable to delete custom post types, confusion around capabilities
- Getting wp.me shortlink for wordpress custom post type
- where is the main file in this plugin?
- Insert Array in Plugin Database
- What is wordpress way to access a plugin’s classes/models to load custom post type data?
- plugin wraps the entire content
- Shortcode Attributes to Return different $_POST
- Plugin onclick button activate other plugin
- How does translation (gettext) work for translating config file of plugin?
- How programatically cause uploads folder to be created?
- using wp_footer hook in a plugin
- Structuring function with registration_errors hook
- Yoast SEO Plug In and my Theme duplicating code. Need some feedback on what to do? [closed]
- Want to create custom design of progress indicator in wpforms
- Using Class loader in WordPress boilerplate
- wp_query ‘s’ parameter does not work with WC_AJAX
- Monitor all the queriers executed by my website
- How to prepare (compress/zip) a plugin to enable updating instead of adding new instance?
- WC Fix Attributes – ‘Add New’ Not Searchable/Delayed
- Allow a particular user to access a particular plugin?
- wordpress plugin add page when activate
- How to dynamically add template in Innerblock?
- Add style to body based on url
- $wpdb->insert not working inside save_post tag
- How to check for already existing plugin versions on activation? and prevent errors
- update_post_meta is not working for me when I use e.preventDefault for update button
- How to create a plugin with automatic update?
- How to call a function from inside class to outside class
- Loading plugin script only on required page?
- Create survey that redirects to sidebar menu customized to answers
- Uploading images to custom table
- Changing author slug for a custom role without using plugin
- Plugin management with my custom plugin
- Plugin Version List not Shown
- How to pass value from WordPress to Javascript
- How do I create a state of “don’t assign anything to variable” if WP_Error throws an error?
- How can I customize Easy Appointment plugin?
- Plugin communication between sites that use it?
- How to change meta data(title, description) for current post?
- how to add custom css at top above all css file for specific url
- Provide http service by wordpress plugin
- wp_verify_nonce fails always
- Custom Plugin: Point to `template_directory`
- WP internationalization not loaded
- Plugin options not appearing on options page using tabbed navigation
- Adding custom cron_schedule prior to wp_schedule_event
- Create plugin with form in post and submit it to specific form
- Storing values in Post Meta vs new tables
- Get page type to display content
- Widget redirecting to home page
- Capturing POST data
- Is an Office a custom post type [closed]
- map urls to plugins
- How to add image for custom taxonomy
- I am using multi image metabox plugin but I did get how to display the images in templete?
- Embed php code in custom field of a plugin [closed]
- How to open author url linked to a new tab in settings page in the WordPress plugin list
- How can I properly sanitize the update_option in WordPress?
- Why is my menu page not being displayed?
- wp_handle_upload – specified file failed upload test
- how to make wordpress remember my choice
- Running a function using Crown WordPress on one day a week, for example, Mondays of every week
- How to make a Template page to show the information of different things Shop and Product page?
- wordpress admin-ajax bad request 400