I have a separate wordpress table where there is only post url in that.
Now, I want post title from that url.
Tried <?php $postid = url_to_postid( $url ); ?>
Doesn't seem to be working good. Returns 0 to some of the urls.
Any ideas/suggestions ?
I have a separate wordpress table where there is only post url in that.
Now, I want post title from that url.
Tried <?php $postid = url_to_postid( $url ); ?>
Doesn't seem to be working good. Returns 0 to some of the urls.
Any ideas/suggestions ?
Try the following query:
$post_title=$wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE guid='$url'");
Or
post_url is a column name
$tbl_new='table name where post urls are stored';
$post_title=$wpdb->get_var("SELECT post_title FROM $wpdb->posts a JOIN $tbl_new b on a.guid=b.post_url WHERE guid='$url'");