Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Synchronize creation Forum to a taxonomy forum

@kimis

Participant

Well it still doesn’t work, what if instead of that, I add a select on the form to create a forum, I create it also in the admin panel. how can I do that because I did

add_action('bbp_new_forum_form_after_content', 'add_formation_field_to_forum_form');
function add_formation_field_to_forum_form() {
    $formations = get_terms(array(
        'taxonomy'   => 'formation',
        'hide_empty' => false,
    ));
    
    if (!empty($formations) && !is_wp_error($formations)) {
        echo '<div class="bbp-form">
                <label for="forum-formation">Sélectionner une formation :</label>
                <select name="forum_formation" id="forum-formation">';
        
        foreach ($formations as $formation) {
            echo '<option value="' . esc_attr($formation->term_id) . '">' . esc_html($formation->name) . '</option>';
        }
        
        echo '</select>
              </div>';
    }
}

I want to link the forum to the taxonomy formation I think it should be more easier but in that way it doesn’t work I have linked formation to forum by doing

function link_formation_taxonomy_to_forums() {
    register_taxonomy_for_object_type('formation', 'forum');
}
add_action('init', 'link_formation_taxonomy_to_forums');
Skip to toolbar