wp_editor with media buttons

You can use following code to achieve this if ( is_user_logged_in() ) { // Editor without media buttons wp_editor( $content, ‘editorname’, array(‘media_buttons’ => false) ); } else { // Editor with media buttons wp_editor( $content, ‘editorname’); }

Uploaded image, but not showing

I think the problem is that you are storing your images in /srv/www/wp-uploads/blog.linformatronics.nl/2013/01 but your link to the image is https://blog.linformatronics.nl/wp-uploads/2013/01/ccs5licence1.png. What you need to do is tell wordpress to store the images in /srv/www/blog.linformatronics.nl/wp-uploads/2013/01. What your trying to do, it seems, is store images in wp-uploads/blog.linformatronics.nl but the folders should be swapped. It’s the … Read more

Use Media upload in custom widget on wordpress 3.5

Check if this works for you: Put this code in jQuery(document).ready( function(){ function media_upload( button_class) { var _custom_media = true, _orig_send_attachment = wp.media.editor.send.attachment; jQuery(‘body’).on(‘click’,button_class, function(e) { var button_id =’#’+jQuery(this).attr(‘id’); /* console.log(button_id); */ var self = jQuery(button_id); var send_attachment_bkp = wp.media.editor.send.attachment; var button = jQuery(button_id); var id = button.attr(‘id’).replace(‘_button’, ”); _custom_media = true; wp.media.editor.send.attachment = function(props, … Read more

Adding upload button in metabox

this is how I do to create upload button in metabox: FILE: template_dir/functions.php add this lines: wp_enqueue_script(‘custom-js’, get_template_directory_uri().’/js/custom-js.js’); // Add the Meta Box function add_custom_meta_box() { add_meta_box( ‘custom_meta_box’, // $id ‘Custom Meta Box’, // $title ‘show_custom_meta_box’, // $callback ‘post’, // $page ‘normal’, // $context ‘high’); // $priority } add_action(‘add_meta_boxes’, ‘add_custom_meta_box’); // Field Array $prefix = … Read more

Override json encoding in rest api

It should be enough to add the content disposition field. But specifically it’s Content-Disposition not Content-disposition I would also add some validation to your filename parameter thats being passed to file_get_contents to ensure it exists and it’s valid. Else you might be vulnerable to directory traversal attacks or remote URL requests

getting uploaded SVG dimensions on front-end

I agree with Tom J Nowell on the use of SVG, but if the upload is an actual image, you can tap into the attachment attributes using, as you suggested, wp_get_attachment_image_src. Those dimensions are actually already recorded and stored when using the WP media uploader, it’s likely that the plugin you’re using makes use of … Read more

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