WordPress fires admin_enqueue_scripts
hook earlier, than add_options_page
, where you put your admin_enqueue_scripts
.
Solution is simple, you need to put your admin_enqueue_scripts
hook outside of the add_options_page
function callback.
function load_wp_media(){
wp_enqueue_media();
wp_enqueue_script( 'waterStampScript', plugin_dir_url( __FILE__ ) . 'js/app.js', array('jquery'));
}
add_action( 'admin_enqueue_scripts', 'load_wp_media' );
Related Posts:
- Enhance Media Manager for Gallery
- Custom collection in media manager?
- Checking if a file is already in the Media Library
- Adding more options to the instance of an image. (Attachment Display Settings)
- Get list of scripts / styles and show file which enqueued them
- Change Media Uploader default directory
- How to extend LINK TO functionality in ATTACHMENT DISPLAY SETTINGS
- How can I view all WP generated thumbnails in Media Manager?
- Modify how gallery.js builds the shortcode [gallery ...] in tinyMCE?
- Bridge WordPress Media API with custom tinyMCE plugin [closed]
- How to get an image transferred via FTP or script to appear in Media Manager?
- Add Additional File Info (jpeg compression & file size) settings to Edit Images Screen
- Is it possible to modify the media library admin screen?
- Using the component outside the editor. select(‘core’) is null
- How to avoid loading same script twice?
- How to replicate Media Library “Add New” on Plugin Settings Page
- Correct check for any admin page with editor
- How to enable sorting in custom media uploader in plugin
- How to load library scripts in admin from plugins in noConflict wrapper?
- Upload multiple images and insert them into custom html code
- wp_editor add media button not working
- Run a function when new image is uploaded in media library
- Completely isolate a plugin view so it doesn’t load the theme
- How to Get Rid of Unwanted Backslashes in WordPress Form Input inside admin menu option
- How to create wordpress media library UI on plugin page
- Integrating a Gutenberg custom block within a larger plugin
- wp.media gallery collection sometimes undefined
- function add custom fields to media gallery
- WordPress Dropdown image select
- Changed media upload path for plugin, but generates error & shows wrong url
- How to destroy or dispose wordpress uploder/manager?
- Creating custom Insert Media page
- Thumbnails for media Library images
- Remove image in post when it’s removed in media library
- How do you filter get_media_items by mime type in a custom media upload tab?
- Enqueue Script in custom plugin before other
- Open media box library from link
- Correct usage of scripts with shortcodes
- Upload to a specific media folder created by FileBird Lite
- Load images from CDN and custom features to “Add Media” dialogue
- upload image to wordpress media library failed for custom post type
- Update Option Stored in Multi-Dimensional Array
- check if Gutenberg is currently in use
- WordPress Plugin Development – Headers Already Sent Message
- Get page content using slug
- $wpdb->insert_id
- Remove profile picture option (and other things) from profile.php (in admin)
- How to disable plugin update notification for a specific plugin in Multisite
- Getting old term value with edited_{$taxonomy} | Hook
- Building a better media uploader for WordPress
- Calling clean_term_cache() fails when called in the same plugin that creates terms, succeeds when called separately?
- Singular name Plugin localization
- On plugin deactivation hide its shortcode
- Can I submit a plugin that follows the PSR-2 coding style guide?
- How to get current page id through the plugin
- Saving data from block editor to the database
- OOP Plugin and Menu – Call to undefined function register_setting()
- How to untrash a post only if it was not a draft?
- Writing a plugin which needs to upload files
- Calling is_single() outside the loop
- update woocommere total value on checkout based on selected payment method
- Loading WordPress Admin Environment
- how to add custom functionality after woocommerce place order button
- Rich text editor settings persist throughout all rich text editors
- Function: Add link to / inside div
- How can I rewrite a URL to pass requests to a custom method via AJAX? (I can’t use admin-ajax.php)
- WP Gutenberg Blocks – How to limit first/root blocks
- How do I update a field of a meta box?
- Following WordPress Markup Is mandatory, got awkward resultyby wordpress standard markup?
- Issue on Setting $icon_url Parameter on WP add_menu_page()
- Are there any official or unofficial guidelines for the styling of a widget?
- How to get error object returned by wp_create_user
- Logout after clicking URL link results in “headers already sent” error
- My WordPress Plugin code breaks customize.php viewpoint
- Make wordpress join default user metas with a column from another table while displaying the wp_users table on the users screen
- $wpdb->prepare is not working like mysql_real_escape_string
- Enqueue ONLY Plugin Styles and Scripts
- Foreign wp_users ID in custom plugin DB table?
- How to do admin ajax request in a plugin for rest api
- How to show comments from different Plugins to same post type?
- The plugin generated 683 characters of unexpected output during activation
- Sanitization and validation input fields – Settings API
- Author Meta in Author URL Link
- Warning: Illegal string offset ‘Andorra’ in … on line 106
- Different style for specific rows in custom list table using WP_List_Table
- get_comment_meta() for a filter hook in a plugin
- form does not generate $_POST request
- Callback function quicktags that uses variable in start tag
- Font Awesome stopped showing icons, shows &# text instead [closed]
- WordPress Plugin Tool Tip Helpers
- How can I add the Post ID to Class Name in Jquery?
- How to show metabox just in post.php in admin?
- Can’t switch theme after activation
- plugin will not offer update even though a new version is available
- How do I replace title with my plugin?
- How to remove a class [closed]
- Adding custom avatar field to comments
- i want to auto create pages with shortcode when plugin is activated and delete when deactivated
- wordpress wp_editor() does not support tag
- Insert meta-description into Yoast-SEO input-field via JavaScript