Header only retrieval in php via curl

class URIInfo
{
public $info;
public $header;
private $url;


public function __construct($url)
{
$this->url = $url;
$this->setData();
}

public function setData()
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $this->url);
curl_setopt($curl, CURLOPT_FILETIME, true);
curl_setopt($curl, CURLOPT_NOBODY, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$this->header = curl_exec($curl);
$this->info = curl_getinfo($curl);
curl_close($curl);
}


public function getFiletime()
{
return $this->info['filetime'];
}


// Other functions can be added to retrieve other information.
}


$uri_info = new URIInfo('http://vsjodha.com/');
$filetime = $uri_info->getFiletime();
if ($filetime != -1) {
echo date('Y-m-d H:i:s', $filetime);
} else {
echo 'filetime not available';
}

Posts Where Filter

add_filter( 'posts_where' , 'posts_where' );
function posts_where( $where ) {


if(!is_admin()){
global $wpdb;


if (isset($_GET['filter_state'])){
$filter_state = intval( $_GET['filter_state'] );
$where .= " AND ID IN (SELECT object_id FROM {$wpdb->term_relationships} WHERE term_taxonomy_id=$filter_state )";
}
if (isset( $_GET['filter_proff'])){
$childs = @implode(',',getChildCategories(intval($_GET['filter_proff'])));
$where .= " AND ID IN (SELECT object_id FROM {$wpdb->term_relationships} WHERE term_taxonomy_id IN($childs))";
}


if (isset( $_GET['filter_type'])){
$where .= " AND ID IN (SELECT object_id FROM {$wpdb->term_relationships} WHERE term_taxonomy_id IN(".$_GET['filter_type']."))";


}

}

return $where;
}

 

Update term count by SQL

update WordPress taxonomies(categories/tags)’ count field after bulk import/delete


UPDATE wp_term_taxonomy SET count = (
SELECT COUNT(*) FROM wp_term_relationships rel
LEFT JOIN wp_posts po ON (po.ID = rel.object_id)
WHERE
rel.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
AND
wp_term_taxonomy.taxonomy NOT IN ('link_category')
AND
po.post_status IN ('publish', 'future')
)

v3

Delete All Existing WordPress Transients in MySQL Database

DELETE FROM `wp_options` WHERE `option_name` LIKE ('_transient_%');
DELETE FROM `wp_options` WHERE `option_name` LIKE ('_site_transient_%');

Remember to use the correct table prefix. In the above example, the default table prefix has been used.