A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

New answers tagged

-1

You could create a plugin for the editor to achieve that. In JS there's the onpaste event. These would be the basic steps: listen for onpaste. Find the closest heading element up the tree from the target element being pasted into. Default to page/post title if no heading elements are found and then back to the default naming convention if all else fails. ...


0

I suggest checking the webserver's error log before poking around in the dark. In my case I found the following error message 2020/01/16 15:30:24 [error] 24844#24844: *206729 client intended to send too large body: 33962282 bytes, client: xxx.xxxx.xxx.xxx, server: example.com, request: "POST /wp-admin/async-upload.php HTTP/2.0", host: "example.com", ...


0

HTML <input type="file" id="id_termine_attachment" multiple="multiple" name="id_termine_attachment[]" value="" size="25" /> PHP function upload_file($_FILES) { if (!empty($_FILES['id_termine_attachment'])) { $supported_types = array( 'application/pdf', 'application/vnd.openxmlformats-officedocument....


0

I was searching the internet, and I found out about this strtolower( wp_get_referer() ); So I was able to place simple if statement and test what page called the admin-ajax. if (strpos($referrer, 'upload.php') === false) { ... }


0

I have added this code to enable everyone to add files function allow_own_attachments( $user_caps, $req_caps, $args, $UserObj ) { if ( empty($args[2]) ) { return $user_caps; // nothing to check } $post = get_post( $args[2] ); // post_id was passed here if (is_object($post)){ //check if $post is an object. If it is't checked the code throws this ...


2

You can check mime type of uploaded image before upload to media. Add mimeTypes in $allowmimeType which you want to allow. then check uploaded files mimetype $fileMimeType. If not found in allowed mimetype then return false. // Insert Attachment function insert_attachment($file_handler, $post_id, $setthumb='false') { if ($_FILES[$file_handler]['error'] ...


0

The answer actually lies on the same page where you inspected your modifications: /wp-admin/media-new.php. If you get to the /wp-admin/media-new.php file, you will get a function: <?php media_upload_form(); ?> And the function is located in /wp-admin/includes/media.php, where you will get the following line: $max_upload_size = wp_max_upload_size(); ...


Top 50 recent answers are included