Insert image in comment reply

What you’re looking for could be a wp_editor() in comment form : wp_editor( $comment->comment_content, ‘content’, array( ‘media_buttons’ => true, ‘tinymce’ => false, ‘quicktags’ => $quicktags_settings ) );

File upload, uploads only file name

The WordPress codex states that “The file MUST be on the uploads directory”. I’ve added a line to move the uploaded file into the uploads directory and changed the guid path. if( isset( $_POST[‘submit’] ) ) { $filename = $_FILES[‘file’][‘name’]; $wp_filetype = wp_check_filetype( basename($filename), null ); $wp_upload_dir = wp_upload_dir(); // Move the uploaded file into … Read more

Custom image size in Media Dropdown

The above problem got fixed after regenerating the thumbnails and by using the following function. function mytheme_image_size_names( $sizes ) { $sizes[‘blog_body_img’] = __( ‘Blog Body Image’, ‘isaumya’ ); return $sizes; } add_filter( ‘image_size_names_choose’, ‘mytheme_image_size_names’, 11, 1 );

Prevent File Uploads other than images

Your solution will prevent non-image file downloads but uploads will still be allowed. You could use the wp_handle_upload_prefilter hook (https://codex.wordpress.org/Plugin_API/Filter_Reference/wp_handle_upload_prefilter) to get to the filename in it’s temp location, inspect it, and set an error. That hook is passed a single array and setting a string to the ‘error’ key will abort the upload processing … Read more

Images uploading to wrong directory after changing to multisite

Check the value of the ms_files_rewriting option in the site_options table. If ms_files_rewriting is disabled, then WordPress will automatically append /sites/number to that Upload Path value for the subsites. This setting should be disabled by default for any Multisite networks created after WordPress 3.5. It should only be enabled for older networks. If that setting … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)