Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

After I added a post by wp_insert_post();

Any callback after I added ? I need permalink of added post.

I have idea only search by title and post-type (I use custom post-type in my case), But any better function ?

share|improve this question
add comment

2 Answers 2

up vote 2 down vote accepted
$post_id = wp_insert_post( $arg ); #returns post ID
$permalink = get_permalink( $post_id ); #returns the permalink

Codex:

http://codex.wordpress.org/Function_Reference/wp_insert_post

share|improve this answer
add comment

Oh I found !

$post_id = wp_insert_post($arg); // return post ID
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.