1

Can I update posts using the post_name (slug) instead of the ID, as I don't have a list of the ID's, but I do have the list of the slugs and the corresponding changes for each one?

1 Answer 1

1
$post = get_page_by_path( 'the_slug', OBJECT, 'post_type' ) ;
$id = $post->ID;

Then you an update post using this ID. Note: Untested, may contain syntax error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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