New answers tagged

0

If you want to update title and description you should not use wp_update_attachment_metadata attachment title and description is not a meta it's a main post detail (attachment is custom post), you can do this with following code. $attachment = array( 'ID' => $id, 'post_title' => $title, 'post_content' => $description ); // now update main ...


0

We can use simply https://wordpress.org/plugins/find-posts-using-attachment/ I hope it is the best way!


2

I stumbled on a good and more global solution for this on Isabel Castillo's blog, by using wp_get_attachment_image_attributes filter: function isa_add_img_title( $attr, $attachment = null ) { $attr['title'] = trim( strip_tags( $attachment->post_title ) ); return $attr; } add_filter( 'wp_get_attachment_image_attributes','isa_add_img_title', 10, 2 )...


0

Now I have an answer for my own question.I solved this issue by using this code.I add this code just for sharing and helping other as it works for me. <input type="file" name="my_file_upload" id="my_file_upload_id" class="bg_checkbox" > function register_team_show_case_setting() { //register our settings register_setting('...


0

{{ post.thumbnail.ID }} will get you the image ID, but to answer what you're after.... <img src="{{ post.thumbnail.src('medium_16x9') | default( Image(1234).src('medium_16x9') ) }}"> Reference


0

You call for a WordPress function before WordPress is fully loaded. A quick and dirty way to fix this is to add require_once(ABSPATH .'wp-includes/pluggable.php'); at the top of your plugin file so it has the needed functions. A better and the correct way of solving this is to wait with your code until WordPress is done by using one of the available ...



Top 50 recent answers are included