Add new plugin maybe considered as uploading file.
Check if the file uploaded is an image or not before handling
if(@!is_array(getimagesize($mediapath))){
$image = true;
}
else {
$image = false;
}
Thanks to: https://stackoverflow.com/questions/15408125/php-check-if-file-is-an-image
So, modify your code to
function mdu_validate_image_size( $file ) {
$image = getimagesize($file['tmp_name']);
if(@!is_array(getimagesize($image))){//check if file is an image
//do stuff
}
}
Related Posts:
- How to add product in woocommerce with php code [closed]
- What’s the best way to use the Featured Image for responsive web design?
- Hide php Notices in Dashboard
- How to correctly submit a search form and display the result in an independent page
- Show the most popular post per week
- Add a class to links in the visual editor (how to get old dialog back)
- Creating custom Woocommerce attribute taxonomies from a plugin
- What is the most efficient way to search users by their display name?
- Passing JSON data from WP Query into AJAX causing NULL errors
- Using Echo in ShortCode – Stuck
- Get used terms by an author as array of strings
- Two posts in same div – WP loop
- Compare two meta key values against each other inside the get_posts array?
- Multiple do_shortcode($content) within one shortcode
- Index showing source code
- WordPress menu deletes when trying to add a hook
- Overriding a theme redux file in child theme
- Validate a users email address when using gmail to register
- selected menu item
- How to show only a certain part of the entry title?
- Programmatically add and remove woocommerce product category
- allow subscribers to see private posts without plug in
- Get image’s size name from it’s dimension
- How to securely provide a $_POST var in WP_Query with PHP 7?
- If Query In Sidebar
- Unreadable pagination
- Is there any risk setting WordPress file permissions and FS method to ‘direct’ on localhost?
- remove wp floating submenu in wp dashboard
- wp_enqueue_scripts leads to error
- Add a product to checkout via form
- My page.php shows the index.php
- Posting and image insertion problems after EasyApache4 and PHP 7 upgrade
- How create a Shortcode with hover and complex options
- Remove from shortcode
- Login to wordpress by clicking a link and specifying usernaname and password in url
- WordPress SQL injection
- How to get all author posts outside of author templates
- Function returns text instead of html [closed]
- How can I display a div ONLY if it is not a certain term page
- Next post link on a bootstrap button
- Echo title attribute php
- how to serialize() mysql update data
- Output: “Array”
- Get a value inside a get_post_meta Array
- Calculate days between two custom field value dates
- Using rules in Posts
- How to make a cookie be on the whole site instead of being on a specific page/
- php – Plugin/theme relative PATH/URI
- Save the value of a wp_dropdown_pages
- Search only working on front page (index) , not working on other pages
- Live search from database table
- wpdb getting avatars and author url
- Dynamically generating an ” reference with PHP
- How to create Loop code for Menu using WordPress?
- Deleting records with AJAX, deleting records as I search
- How a HTML form can trigger a PHP function?
- Custom Login page, redirection and restrictions
- Display custom field value in woocommerce variable product via jQurey
- Tag title not being returned in page title of tag archives
- Allow a user or role to view drafts and previews, but not other admin privileges?
- get orders of today’s date
- foreach not returning expected results
- Preventing direct access to a page in WordPress
- Passing Current User ID into SQL statement
- Load WordPress core but with specific plugins
- Change user metadata on registration (show_admin_bar_front = false)
- How to insert multiple rows and columns in database using array
- I am facing error in the wordpress single page php coding
- How to output values from a loop into a javascript array
- Display child-page links in sidebar on both Parent Pages AND Child Pages
- Cron not sending wp-mail()
- custom post type column countdown
- Adding body class to html tag that already has language attrubutes?
- Admin backend, show post from a category and exclude the posts from subcategories
- Add missing alt tag to featured images for “storefront” theme
- Clone the “proceed to cart” button and place it above checkout on the cart page, but only appear display size is 320px
- Load admin bar without wp_head or wp_footer [duplicate]
- Latest Post Thumbnail Alt Text Missing
- Add Alt attribute to image served with php
- Processing forms with php to wordpress database
- Relationship between custom post type and page/single templates
- Getting most popular posts based on Facebook comments count
- WordPress get_post_meta issue
- Woocommerce Price Text
- If Elseif Query
- Querying multiple meta_keys in WordPress SQL query
- Enabling XSendFile causes 404 for images on WordPress Multisite / Network
- 3 domains, 1 wordpress install, redirecting and changing domains on live site
- Cannot Upload Custom Header Image into WordPress Dashboard
- Generating a number based on post ID
- Add comma between variables [closed]
- Ajax Load More or View More functionality for woocommerce category layout by template overriding
- echo vs output variable [closed]
- Display Post Titles on top of the_post_thumbnail()
- Properly process a custom WP REST API request (Authenticate, Authorize + Validate)?
- Losing Session ID and sessionStorage when navigating to other domains on Multisite
- Contact form with dynamic dropdown and filter
- Critical Error customiser
- rest_cannot_create_user – Sorry, you are not allowed to create new users. CURL WORDPRESS REST API
- links Slick jS library using wp_enqueue_scripts not pulling