Also set story as post parent for chapters
For the future.
This commit is contained in:
parent
ac6a2422de
commit
713cf7db06
@ -62,6 +62,8 @@ function fictioneer_generate_test_comments( $post_id, $number = 3 ) {
|
||||
*/
|
||||
|
||||
function fictioneer_generate_test_content() {
|
||||
global $wpdb;
|
||||
|
||||
if ( ! current_user_can( 'manage_options' ) || get_current_user_id() !== 1 || ! WP_DEBUG ) {
|
||||
return;
|
||||
}
|
||||
@ -158,6 +160,14 @@ function fictioneer_generate_test_content() {
|
||||
fictioneer_generate_test_comments( $chapter_id, $comment_count );
|
||||
|
||||
update_post_meta( $chapter_id, 'fictioneer_chapter_story', $story_id );
|
||||
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"UPDATE {$wpdb->posts} SET post_parent = %d WHERE ID = %d",
|
||||
$story_id ?: 0,
|
||||
$chapter_id
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3051,6 +3051,16 @@ function fictioneer_save_chapter_metaboxes( $post_id ) {
|
||||
if ( get_option( 'fictioneer_enable_chapter_appending' ) ) {
|
||||
fictioneer_append_chapter_to_story( $post_id, $story_id );
|
||||
}
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$wpdb->query(
|
||||
$wpdb->prepare(
|
||||
"UPDATE {$wpdb->posts} SET post_parent = %d WHERE ID = %d",
|
||||
$story_id ?: 0,
|
||||
$post_id
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user