4
I’m trying to put together a page for editing categories, tags and custom taxonomies via front end. However, now I cannot find the correct function to submit the update of the fields.
The code so far:
<?php
/*Template Name: Page Template Editar Cetegoria*/
get_header(); ?>
<section class="conteudo-geral">
<section class="conteudo" style="width: 990px" role="main">
<?php
$pid = $_REQUEST [ 'pid' ];
$taxonomia = get_term_by('id', $pid, 'category', 'ARRAY_A');
$nome_taxonomia = $taxonomia->name;
$descrição_taxonomia = $taxonomia->description;
?>
<form action="" method="post">
<tr class="form-field form-required">
<th scope="row" valign="top"><label for="name">Nome</label></th>
<td><input name="name" id="name" type="text" value="4Cast" size="40" aria-required="true">
</td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label for="description">Descrição</label></th>
<td><textarea name="description" id="description" rows="5" cols="50" class="large-text"> </textarea><br>
</td>
</tr>
<p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Atualizar"></p>
</form>
</section>
</secrion>
<?php get_footer(); ?>
Thank you very much for the answer, it will enable the improvement of many forms!!! However, the wp_insert_term function, to add a new taxonomy, the center of doubt is like editing taxonomy! In my code, I have already been able to create the editing page that retrieves the values of the name and description of the database taxonomy, the function I need now, is the one that updates these values in the database, after Submit!
– Felideo Desittale Paravimnce
Hi, so please update your question with the code you are using.
– brasofilo
This is exactly the code I’m trying to build to edit the category. I’ll explain further: I have a page where the user can add a category, via front end. Ex: Category Name => Maria Category Description: Maria is a nice girl. On the category page there is a link that redirects to the page that contains the above code, which should be for the user to edit the category. Ex. Category Description: Maria is a nice girl. Change to: Maria is a boring girl. Click on Ubmit and the category is updated. That’s what I’m failing to realize.
– Felideo Desittale Paravimnce