function load_grid() {
if ( current_user_can( 'level_10' ) ) {
wp_enqueue_style('grid_css', plugins_url('/lib/css/grid.css', __FILE__) );
wp_enqueue_script('grid_js', plugins_url('/lib/js/grid.js', __FILE__), array('jquery') );
}
}
add_action('wp_enqueue_scripts', 'load_grid');
Related Posts:
- wordpress plugin add page when activate
- Conditionally enqueue a widget’s script/stylesheet in HEAD (only when present on page!)
- Loading external page template and enqueue script from plugin causes 403 forbidden error
- How do I force wp_enqueue_scripts to load at the END of ?
- When can you get current page ID and initialize hooks right after?
- enqueue script only if it is not already enqueue
- How can I dequeue a Plugin Stylesheet?
- Which method is best to enqueue scripts
- WordPress Capabilities: edit_user vs edit_users
- How to load different css file for different pages
- Allowing Custom Capability to Manage Plugin Options
- Get info (url) from already enqueued styles
- Declaring script dependencies between scripts enqueued with different action hooks
- Pass $this to function nested in another public function of the same class
- Dequeue / Deregister script and replace it with a new plugin
- Custom data-id wp_enqueue_script
- wp_enqueue_scripts not working inside shortcode
- wp_enqueue_script fails to include in footer
- Avoiding Duplicate function names in Post Loop (WP_Footer script)
- Is it possible to enqueue CSS files from plugin before theme’s CSS files?
- How to remove style and js from theme and add your own style and js where shortcode is used?
- React JSX in WordPress Plugin Development
- Enqueue WordPress plugin scripts below all other JS
- jQuery for custom plugin not working with Divi theme
- Adding Font Awesome to WP Plugin
- Unable to delete custom post types, confusion around capabilities
- How can I remove the WordPress-Version (?ver=5.x) from my plugin
- Create shortcode to echo javascript
- Why am I unable to load scripts in head in plugin?
- wp_enqueue_style on template_redirect level?
- Custom plugin – load enqueue only for this plugin
- plugin enqueue style on all pages
- is it possible to hook every page style?
- Deregister scripts from plugin
- Custom CSS not being added by plugin
- why the wp_register_script doesn’t work for register_activation_hook
- How To Create A File Archive in WordPress?
- Edit all $wp_scripts at once to $in_footer = false
- Edit all $wp_scripts at once to $in_footer = false
- Why won’t wp_enqueue_script work within any plugin file?
- How to add styles to a submenu page?
- Why can I not deregister my style and script on custom post type?
- WordPress include scripts and style in plugin page
- plugin’s script and style enqueing not working on Thesis
- wp_enqueue_script doesn’t load JS in plugin
- How to implement WordPress plugin update that modifies the database?
- WordPress Plugin Development In MVC Architecture, How?
- Customize plugin update “new version is available” text
- “Donate to this plugin” for WordPress.org Plugin Authors
- What happens when two plugins have the same 3rd party class included into them?
- How to handel multiple checkbox field in the admin settings page with Settings API
- Update Multiple Post Meta for the Same Post In One call?
- wp_insert_user – how to send verification email before logging in
- How to show custom message once on plugin activation?
- How do I configure WordPress to talk to a Microsoft SQL Server database?
- How to load a new template page according to a particular URL?
- PDF download – use wordpress functions
- API to filter new user registration $POST data?
- Set cookie then immediantly refresh the page
- How to add an attribute to the body tag with a plugin?
- Override the core function locate_template
- Admin page: form with enctype=”multipart/form-data” does not transfer its data
- Set user ID at time of wp_create_user
- How to Create a Custom Plugin Permalink
- Send Custom welcome email to specific user group
- WordPress Backend HA (Automatic failover)
- Is it necessary to auto delete my WP plugin database tables when users deactivate/delete my plugin?
- Custom post types – remove default post supports through empty array?
- How to insert and call new data in wordpress website database through a plugin
- How to be escape Variables and options when echo?
- Release the plugin in the WordPress repository where redux is used
- Dokan Marketplace store link in single product page
- Using meta_query in a WP_Query not working for numbers properly
- How to add captcha to publish widget
- How to add logo to a WordPress Custom Plugin?
- Use a custom block in another block
- Using OR Condition with facetwp facets
- How to copy the all WordPress media items to another custom plugin folder?
- See which user role / capability is needed to use a plugin
- Personality quiz in wordpress using a plugin
- How can we get this dynamically as this folder may not be by the same name always → wp-admin
- Error on plugin activation and creating new page
- Child theme modifications not showing up
- Why is my shortcode not working?
- wp_remote_post To external API multiple values with the same key
- what’s different between wpdb->prefix and table_prefix
- Can we rename a plugin directory for a already launched plugin?
- How to create a new database table whenever user changes options
- Am I correctly adding styles to plugin?
- How can I insert a record into a custom table from my custom form in my custom admin page?
- how to create table during plugin installation in side a class
- WP_Filesystem usage within a block of code
- Why function hooked using object are executing at all time?
- What is the Object for WP_Error Class?
- Ajax in Plugins: returns the whole page
- Any way to hook into WP after a page displays?
- How to only Load scripts on variable products page
- WP Elementor Pro causing crtical failure on website
- Function not being called on form submit, only blank admin-post.php page
- How to give specific class name to category in wordpress with code snippets