WP All Import Export Subset of Posts by Slug Array [code snippet]


WP All Import Export Subset of Posts by Slug Array [code snippet]

When performing a WordPress blog migration you sometimes just need to export a certain number of posts vs the entire collection. The easiest way I have found to do this is by performing a custom query using the list of posts by their url slug.

// WPQuery args for slugs - create array fro list https://delim.co/
'post_type' => 'post', 'post_status' => array( 'publish' ), 'post_name__in' => array(
'slug-1','slug-2'
)

 



Written by: Jake Lett
Jake Lett is a results-driven B2B marketing consultant with 15+ years of experience helping businesses boost online visibility, generate qualified leads, and increase sales. Specializing in SEO, HubSpot, and PPC campaign management, Jake leverages proven strategies to deliver measurable growth. As a Certified Google Ads Specialist and HubSpot Developer, he is committed to driving impactful results for his clients.

Related posts

Tags: ,

Want to Get Email Updates of New Articles?

Join My Email Newsletter