If you mean you would like to change a custom post type to post type post
, see Post Type Switcher.
If you mean you would like to move content from a meta field to post_content
, see pods()->save() and pods()->find():
// Get 100 posts of content type 'post'.
$pod = pods( 'post', [ 'limit' => 100 ] );
// For each.
while( $pod->fetch() ) {
// Copy the content of 'text_field' to 'post_content'.
$pod->save(
[
'post_content' => $pod->field( 'text_field' ),
],
null,
$pod->field( 'ID' )
);
}
…which would duplicate content of text_field
to post_content
for 100
posts of content type post
.
Setting 'text_field' => null,
as a parameter would delete the content of that field. Should not be done until migration is complete, and backup the database before attempting anything like this. delete_post_meta() can also delete meta values given an ID
and meta_key
.
get_posts() can be used as an alternative to pods()->find() / ->fetch()
, looping with foreach
and querying with an array of WP_Query arguments.
Data migrations and transformations are not trivial. Backup the data.
Another option is to export a WordPress XML file with WP Admin > Tools > Export
and import with WP Admin > Tools > Import
after editing with a text editor. There is also WP All Import and similar plugins.
Migrating taxonomies, similar to relationship fields, is the most complex, because taxonomy terms have to be created and then mapped to new IDs. If by “convert categories to the default one” you mean move terms from a custom taxonomy to the taxonomy category
, one may be able to get away with changing the term_taxonomy_id
numbers in the wp_term_taxonomy
and wp_term_relationships
tables, where 1
indicates that a term or a relationship belongs to the category
taxonomy. Doing it that way without exporting and re-importing all the terms would require that no term names overlap between the two taxonomies.
Regarding the pods-convert repository, the tutorial is in the readme on the linked page. It has not been updated in 8 years; last time I attempted to run it, it gave several different errors… WP All Import/Export or editing a WordPress XML export will likely be the most approachable.