This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$url = "http://www.example.org/"; | |
$curl = curl_init(); | |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($curl, CURLOPT_URL, $url); | |
$data = curl_exec($curl); | |
curl_close($curl); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!function_exists('get_post_id_by_meta_key_and_value')) { | |
/** | |
* Get post id from meta key and value | |
* @param string $key | |
* @param mixed $value | |
* @return int|bool | |
* @author David Mårtensson <[email protected]> | |
*/ | |
function get_post_id_by_meta_key_and_value($key, $value) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_meta_by_meta_id( $meta_id ) { | |
global $wpdb; | |
$meta[meta_id] = $meta_id; | |
$meta[post_id] = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %s", $meta_id) ); | |
$meta[meta_key] = $wpdb->get_var( $wpdb->prepare("SELECT meta_key FROM $wpdb->postmeta WHERE meta_id = %s", $meta_id) ); | |
$meta[meta_value] = $wpdb->get_var( $wpdb->prepare("SELECT meta_value FROM $wpdb->postmeta WHERE meta_id = %s", $meta_id) ); | |
return $meta; | |
} |