Is your $wpdb->insert multiple post query not generating any permalinks? All you may need is to add in post_name inside your WPDB query.
1 answers
1
Using post_name to create multiple permalinks
Your WPDB query should contain a post_name argument.
To create a custom slug for multiple posts, use the method below to generate unique permalinks.
$i = 0; foreach ( $new_posts as $new_post ) : $i++; $post = array( 'post_type' => 'post', //your post type 'post_title' => 'Hello WP Wizard World!', 'post_name' => 'custom-post-slug-' . $i, 'post_date' => date( 'Y-m-d H:i:s' ), 'post_status' => 'publish', 'post_author' => 1, 'comment_status' => 'closed', 'ping_status' => 'closed', ); $wpdb->insert( 'wp_posts', $post, array( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' ) ); endforeach;
— Support WizardAnswer 1