Tag Info

New answers tagged

0

You need to pass the $profileuser->ID as the second argument when you call your function and define it accordingly: add_filter('wp_handle_upload_prefilter', 'my_pre_upload', 2, 2); // (3rd param is priority, 4th is number of args) // and pass the $userid as argument to your function function my_pre_upload($file, $userid = false){ // if no user ...


1

yes, the naming convention for resized images is name-{width}x{height}.extension. Is it good enough info to base a regex on? in practice most likely yes, but in theory no. You just can't know if mark-20x20.jpg was not simply uploaded that way, and even in places where you know that a resized image should be used you have no way to know if wordpress had ...


1

That's the pre-3.5 media interface so I think you must be on 3.4.x? Anyway the first way should work as long as you're using the browser (non-multifile) upload... try changing add_filter( 'flash_uploader', '_force_html_uploader' ); to add_action( 'pre-html-upload-ui', '_force_html_uploader' ); and the "js/upload.js" (note the subdirectory - it's ...


0

Please set maximum execution time like below : 1 - Modify your php.ini file and set ini_set('max_execution_time', 150); OR 2 - Modify your site root .htaccess file and set php_value max_execution_time 150 Note : you can extend it as per your need. Here 150 means 2.5 minutes.


0

There are different approaches you can follow. In my suggestions, first would be shut down your site. Then follow the steps given in this link below: http://stackoverflow.com/questions/5922762/eval-base64-decode-php-virus In additional, you should install Sucuri, Threat scan plugins on to you environment to check the code and fix them.


0

Thanks @shady-m-rasmy I used the code you mentionned, and it seems that the second foreach loop (below - in the custom template part) is not necessary as it is only executed once. foreach ($_FILES as $file => $array) { $newupload = my_handle_attachment($file,$pid); } So it only leaves with $newupload = my_handle_attachment( ...


4

WP sanitize_file_name() function doesn't handle those characters by default. You can add filter and sanitize those to avoid encoding issues. function mamaduka_sanitize_file_name( $filename ) { $filename = strtr($filename, ...


1

There isn't much point to distinguishing admin-ajax.php since it's essentially same file with same logic running for many many purposes. You are passing action data and hooking into respective action. So action is your identifier. If you are reusing same action and need to further differentiate — just pass more data with your GET/POST request and check for ...


0

You can hard-code this change for all your sites like this: 1. Create a new php file with a path like this: wp-content/mu-plugins/no_date_assets.php If the wp-content/mu-plugins folder does not already exist, you will have to manually create it. 2. In that file paste the following: <?php $uploads_use_yearmonth_folders = get_option( ...


0

I found it and its work great for me, I used the solution in this answer to solve my problem but I'll not chose my answer as a correct answer because the solution in that question uses this function media_handle_sideload, even if WordPress codex told that this function work like the media_handle_upload function. but I'll wait until someone give me the answer ...


0

code from my theme adjusted to you <fieldset class="images"> <input type="file" name="my_file_upload[]" id="my_file_upload[]" multiple="multiple"> </fieldset> <fieldset class="memes"> <input type="file" name="my_file_upload[]" id="my_file_upload[]" multiple="multiple"> </filedset> and its working



Top 50 recent answers are included