надо сделать, но как-то лень...
 

Произвольные поля в bbpress

Добавляет произвольные поля во фронте

// Add custom fields to bbpress topics on front end
add_action ( 'bbp_theme_before_topic_form_content', 'bbp_extra_fields');
function bbp_extra_fields() {
   $value = get_post_meta( bbp_get_topic_id(), 'YOUR-FIELD-NAME', true);
   echo '<label for="bbp_extra_field">My Extra Field:</label><br>';
   echo "<input type='text' name='YOUR-FIELD-NAME' value='".$value."'>";
}

//Save and update the values from the front end
add_action ( 'bbp_new_topic', 'bbp_save_extra_fields', 10, 1 );
add_action ( 'bbp_edit_topic', 'bbp_save_extra_fields', 10, 1 );

function bbp_save_extra_fields($topic_id=0) {
  if (isset($_POST) && $_POST['YOUR-FIELD-NAME']!='')
    update_post_meta( $topic_id, 'YOUR-FIELD-NAME', $_POST['YOUR-FIELD-NAME'] );
    
}

Источник:

bbPress and custom fields

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *