Put the following line before using the function.
require_once( ABSPATH . '/wp-admin/includes/image.php' );
Related Posts:
- How to include PHP files in plugins the correct way
- Creating a table in the admin-style?
- How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?
- body_class hook for admin pages
- Why does WordPress add 0 (zero) to an Ajax response?
- Passing arguments to a admin menu page callback?
- function deactivate_plugins does not exist
- Change admin language based on user (in single-site)
- What is the real intention for admin-post.php?
- What is an alternative method to the WordPress private _doing_it_wrong() function
- Understanding WordPress functions’ naming conventions
- Using OOP plugin’s methods throughout the website
- Admin config screen without menu
- Make Categories and Tags required in admin
- function triggered by “manage_users_custom_column” filter not working
- How to add HTML / Form to an Admin Bar Menu
- How can I change the frequency of a scheduled event?
- WordPress plugin how to run function when button is clicked
- When is it appropriate to put functions on page template vs. functions.php?
- Shortcodes, output buffering, and WordPress functions
- How can i list current author’s categories?
- Determine which theme location a wp_get_nav_menu_items is for
- Error with Custom Admin Screen in iframe Thickbox
- why don’t I get error messages in admin when developing?
- WP_Error handles errors, but how can I show success with a message?
- When to check if a function exists
- Checking for existence of a page by title?
- Dynamically Override Fancy Title
- Problems with removing admin bar
- Problem with `wp_mail()`
- Calling a function from functions.php in custom page/ blog post
- Check if I am in the Admin Panel (wp-admin)?
- What is the Difference between directly call a function and call a function using add_action?
- Call to undefined function get_blog_option()
- JS / JQuery form validation in backend admin menus
- How to put placeholder text in the main post input area?
- What is the difference between current_page_parent and current_page_ancestor?
- Plugin development: is adding empty index.php files necessary?
- Undefined function wp_set_password
- Does add_filter work outside functions.php
- Is it possible to modify the media library admin screen?
- What function to hook for changes made in status and visibility of a post
- What does $_registered_pages do?
- how to use preg_replace for wordpress video?
- Plugin Uninstall and Deactivate via Options Menu
- Get user id for delete and update selected user
- Add tab to profile.php wordpress plugin development
- WordPress Ajax callback function from plugin – OOP
- How can I add a CSS rule to edit.php?
- wp_enqueue_script + wp_enqueue_style Since When
- Admin auto-refresh is interfering with Firebug — how to prevent it?
- Widget update function not saving values
- Including a JS source with an admin page
- add more custom post types and custom role to the code
- $content variable – Is this a reserved variable for a WordPress function? – php / wordpress
- How to use WP_Term with (menu) argument in the wp_nav_menu?
- WordPress not working on localhost
- WordPress after content Hook & external template part
- Enqueue scripts in footer
- override pluggable.php functions
- Retrieve contents/page names of various pages for use in a plugin
- Can wp_list_comments output into variable?
- is user logged in not working
- Can I change header.php of current theme through a plugin function?
- maintaing consistent layout wordpress dashboard
- get_current_screen() return null
- Add column and post filter for a custom post type field on the edit.php page
- Override class inside $atts shortcode_atts in WordPress
- creating custom function to log actions in plugin
- Is there no admin ui guide for 4.x?
- add_rewrite_rule works in themes function php but when moved into plugin it stops working
- Maximum lifetime for nonce
- Where can i find wordpress auto update code flows?
- Correct check for any admin page with editor
- Add function to Dokan ajax class
- foreach argument to get specific file types getting too many returns
- Remove from a div by class name from post page if post author role is not administrator
- Function not working on any file other than the main plugin file
- Building WordPress Themes With Bootstrap with Adi Purdila → TutsPlus
- How to return a blank page
- Ajax not working to insert, query and result data
- Adding admin for specific users
- How do I control the list of Pages an author can see?
- Template file structure , wordpress hook for altering the template
- WordPress permalink setting
- How can I see a varibles value when my plugin runs?
- How can I add recent posts to menu like mashable
- Why is ‘register_activation_hook’ undefined?
- What happens when you create/edit a menu
- Dynamic banner for use on external sites
- How can i call from custom fields to the category editor?
- loop and in admin header problem
- Custom options page for themes
- Why does this fail: Disabling plugins enqueue_script() in functions.php
- modify buddpress adminbar only in admin pages
- Call do_action() within WordPress cronjob
- How to plugin function code move to theme function.php ? I’ve tried below code but not working [closed]
- WordPress simple ‘Hello World’ plugin – problems
- get_term_by() returning null on plugin
- Sticky bar with filter button and product count