How to remove the images from “Uploaded to this post”?

You have to unattach the images from the post. And that means setting their ‘post_parent’ => 0 in wp_posts database table. The plugin Unattach and Re-attach Media Attachments does exactly this, and it uses the following command to this end: $wpdb->update( $wpdb->posts, array( ‘post_parent’ => 0 ), array( ‘id’ => (int)$_REQUEST[‘post_id’], ‘post_type’ => ‘attachment’ ) … Read more

How can I change the to for lazyload wp smilies

You have to use the same quotes around the src attribute as WordPress uses. So filter the URL like this: add_filter( ‘smilies_src’, function( $src ) { return “”https://wordpress.stackexchange.com/questions/116078/data-original=”$src”; }); And while I was on it, I noticed the doc block for the function translate_smiley() is wrong, so I have written a small patch. 🙂

Why am I getting and error from wp_get_attachment_image_src?

PHP does not support the function array dereferencing, which you want to do. In simple words – you can’t treat function as array. What you should do is: <div id=”canvas” class=”plan-page” style=”background-image: url(‘<?php $image_src = echo wp_get_attachment_image_src( stripslashes($options[‘sitePlan’]), ‘full’); if ( is_array($image_src) ) echo $image_src[0]; ?>’);”></div> Or to be even more correct: <?php $image_src = … Read more

How can I get url from image tag in feed with fetch_feed?

I found alternative solution for my problem. Instead of using fetch_feed, I used DOMDocument in PHP. This is my code <?php $rss = new DOMDocument(); $rss->load(‘http://techdaily.vn/feed/’); $feed = array(); foreach ($rss->getElementsByTagName(‘item’) as $node) { $item = array ( ‘title’ => $node->getElementsByTagName(‘title’)->item(0)->nodeValue, ‘link’ => $node->getElementsByTagName(‘link’)->item(0)->nodeValue, ‘image’ => $node->getElementsByTagName(‘image’)->item(0)->nodeValue, ); array_push($feed, $item); } $limit = 1; for($x=0;$x<$limit;$x++) … Read more

Using mysql to replace img src?

This feels like it is too link-heavy for an answer, but oh well. You can either use the Velvet Blues Update URLs plugin or the Serialized Search and Replace script. Either will allow you to search for a string in the database and change it to something else. The former lets you do it from … Read more