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
- wp media uploader and ID3 tags
- WordPress Media Uploader not displaying image that has just been uploaded
- Using a multiple element in widget form
- How can I avoid conflicts between plugin and theme?
- How to control an elements classes from multiple Gutenberg sidebar controls?
- WordPress class, using add_action to call member function does not work
- random code at the end of file after plugin upload
- How Can I add Fields in wp-option table?
- Where do I put my add_action(… and add_filter(… and do I need to remove them?
- $wpdb->prepare with LIKE and sprintf
- ajax recursive calls on wordpress returning answers outsite the function scope
- Why in this archive page that call query_posts() function show only the last 10 posts?
- Quasi-custom API Call Plugin
- How can I show posts for a single category?
- Show content without a post
- WP ajax requests not stacking?
- In wordpress plugin wp_signon shows error
- Full documentation about $args for register_rest_route?
- Is it possible to load the css just on my plugin admin page?
- Problem with autoloader and namespaces
- How can I control if post updated
- How to create taxonomy without using register_taxonomy () function
- AJAX call returns ‘testtest0’ instead of ‘test’ – why?
- Proper Prepare Statement for ALTER TABLE and using AFTER
- Get audio metadata on file upload
- Clean way to initialize plugin in newly-added site when plugin has been network activated?
- Bootstrap Error in WordPress plugin
- Loading Images from Javascript on the Front End
- How to deal with different jQuery versions?
- Can I attach a plugin via my add_filter callback contents?
- Custom payment method after payment user is logged out on thank you page
- The URL of images on my website changed after being set as featured image
- extraprops override existing props
- WordPress Favicon not Working For Images/Videos/PDFs
- HTMLCollection not counting right in editor? / for loop not working on elements in DOM
- Media Library Cleanup A Thought Exercise
- Trying to rename a file upload as the hash of file content on wordpress
- Getting products information, in woocommerce based on products ID
- How the add_action is included in the plugin development
- Fatal error: Uncaught Error: Using $this when not in object context
- How can I measure CPU and RAM used by my theme or plugin
- want to confirm popup with “Yes” and “No” button when user click on add to cart
- do I need to sanitize a shortcode’s function input?
- Email content as comment
- set a custom post type to a taxonomy term programmatically in metabox
- Warning: Illegal string offset – on homepage
- Modify search form with plugin
- Organising and completing posts (mark as read and hide)
- How to display properly exception or echo string after posting in plugin?
- How can I add recent posts to menu like mashable
- When using an options array the Settings API isn’t creating the database record
- the correct way to use options from settings page [closed]
- How do I query posts and have their related taxonomies returned in the results?
- On one of my sites a file is shown as 404 but the file IS there
- I want to add post meta for picture thum during submit for revision
- How to synchronize an e-commerce site and a pharmacy management software?
- woocommerce features to add product along with link
- Extend WP_List_Table class – Edit wp_usermeta – WPPB.me Boilerplate – Action error
- wp_head is not fired from the hook I have used in my plugin