Hot answers tagged

3

I've finally solved! The problem was that simply using update_user_meta( $user_id, 'mycoverimage', $_POST[ 'mycoverimage' ] ); The image was saved without generating attachment metadata. In fact, checking my table, it got only usermeta id which is not the attachment id. So I had to change a bit my uploading function according to codex with the use of ...


2

I suggest you to use the more newer media manager dialog; WordPress will hanlde all the image upload stuff, including generating intermediate sizes and attachement metadata. Here a working example (it is a quick example built from a previous code, it may needs some tweaks to be used on production): add_action( 'admin_enqueue_scripts', 'load_wp_media_files' ...


2

This can be done easily via dashboard. Firstly check how many users you have in the database by going to Users --> All users and delete those users whom you don't in the database by clicking on delete user. In the next step you get an option whether to delete all the content owned by the user(going to be deleted) or to attribute all the content to some ...


1

Not sure it will make a difference, but as you just want one value you can get get_var instead of get_col. I tweaked the query slightly to what I know works: function get_attachment_id($image_url) { global $wpdb; $attachment = $wpdb->get_var($wpdb->prepare("SELECT ID FROM ".$wpdb->prefix."posts WHERE post_type='attachment' AND guid='%s'", $...



Only top voted, non community-wiki answers of a minimum length are eligible