Synchronize creation Forum to a taxonomy forum
-
Hello, I have a taxonomy forums that is is linked to the user, how can I do to create a forum on bbpress and when it’s done it also create a forum on my taxonomy
my code is :
function create_forum_taxonomy_entry($forum_id, $forum_args) {
$forum_title = get_the_title($forum_id);
$forum_slug = sanitize_title($forum_title);error_log(“Création du forum : ” . $forum_title);
error_log(“Slug du forum : ” . $forum_slug);// Insertion du forum dans la taxonomie forum
if (!term_exists($forum_title, ‘forums’)) {
$result = wp_insert_term($forum_title, ‘forums’, array(
‘slug’ => $forum_slug
));if (is_wp_error($result)) {
error_log(“Erreur lors de l’insertion du terme : ” . $result->get_error_message());
} else {
error_log(“Term créé avec succès : ” . print_r($result, true));
}
} else {
error_log(“Le terme existe déjà : ” . $forum_title);
}
}
add_action(‘bbp_insert_forum’, ‘create_forum_taxonomy_entry’, 10, 2); but this function isn’t calledthe file has another function below and it works so it’s not the calling of the file
- You must be logged in to reply to this topic.