Update from Git Manager GUI
This commit is contained in:
@@ -125,18 +125,22 @@ class WBF_Setup {
|
||||
$page_title = sanitize_text_field($_POST['page_title'] ?? 'Forum');
|
||||
|
||||
if ($create_page) {
|
||||
$existing = get_posts(['post_type'=>'page','s'=>$page_title,'posts_per_page'=>1]);
|
||||
if (empty($existing)) {
|
||||
$page_id = wp_insert_post([
|
||||
'post_title' => $page_title,
|
||||
'post_content' => '[business_forum]',
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'page',
|
||||
]);
|
||||
if ($page_id) {
|
||||
update_option('wbf_forum_page_id', $page_id);
|
||||
$success = get_permalink($page_id);
|
||||
}
|
||||
global $wpdb;
|
||||
$existing_id = $wpdb->get_var( $wpdb->prepare(
|
||||
"SELECT ID FROM {$wpdb->posts} WHERE post_type = 'page' AND post_status = 'publish' AND post_content LIKE %s LIMIT 1",
|
||||
'%[business_forum]%'
|
||||
) );
|
||||
if (empty($existing_id)) {
|
||||
$page_id = wp_insert_post([
|
||||
'post_title' => $page_title,
|
||||
'post_content' => '[business_forum]',
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'page',
|
||||
]);
|
||||
if ($page_id) {
|
||||
update_option('wbf_forum_page_id', $page_id);
|
||||
$success = get_permalink($page_id);
|
||||
}
|
||||
} else {
|
||||
$success = get_permalink($existing[0]->ID);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user