Need to get the 'GUID' value for WordPress plugin

I have developed a plugin for creating automatic page which containing the following code:

$new_page = array(

'slug' => $_REQUEST[sl_store],

'title' => $_REQUEST[sl_store],

'content' => "$_REQUEST[sl_store] <br> $_REQUEST[sl_address]"
);



$new_page_id = wp_insert_post( array(

'post_title' => $new_page['title'],

'post_type'     => 'page',

'post_name'  => $new_page['slug'],

'comment_status' => 'closed',

'ping_status' => 'closed',

'post_content' => $new_page['content'],

'post_status' => 'publish',

'post_author' => 1

 ));

The page is creating fine. However, I need to fetch the "GUID" value for the newly created page from the DB.

Can anyone help me?

Upvotes: 0

Views: 1302

Answers (1)

Hobo
Hobo

Reputation: 7611

There's a get_the_giud() function (see here). So

get_the_guid( $new_page_id );

should do what you need.

Upvotes: 1

Related Questions