The WordPress website I am debugging is used as an intern tool to publish reports.

When a user want to create a new report, they select the function, select the categories of informations they want to add, then at the bottom text boxes will be created with the right titles and people can then write the informations they have. When they click “publish” it posts a report with all the caterogies, with the title of each one followed by the info.

My problem: One of the categories, named Urgences Environnementales, is showing correctly in the list of categories when creating a new report. If I click on it, it creates the text box at the bottom, but when I publish, it’s not in the report.

To build the website, they used child themes. One is for the report. In the functions.php file, I can see this code:

foreach($get_posts as $idnumber){
$tableau_cog .= htmlspecialchars("<br/>".get_field('tableau_cog', $idnumber->ID));


update_field('tableau_cog',preg_replace('/(<br[s]?[/]?>[s]*){2,}/', '<br/><br/>', htmlspecialchars_decode($tableau_cog)), $identificationRapport);

All the other categories have the same code but with their respective names.
This is in the child’s theme:

if(in_array( 'Tableau COG', $tâches)){
      echo "<h2 style="text-align: left;"><strong>Tableau COG</strong></h2>";
      simplebox(in_array( 'Tableau COG', $tâches), get_field('tableau_cog'));

Again, the other categories have the same code with their names.

The problem is that it seems they simply changed the name of an old category, as Tableau Cog is not a category. The category is named Urgences Environnementales and titled Urgences_Environnementales.

I tried changing the names of tableau cog everywhere by my category name (respecting the name vs title) but it’s still not working. I tried creating a new category completly, adding the same code with the new category name and title but it’s still not working. I see both categories as nested under another category named the same but with a word between parenthesis. I cehcked everywhere in the code using grep and I cannot find any other tableau_cog nor Environments Urgencies nor the word between parenthesis.

I am very sorry for my ignorance. I tried all day to understand WordPress, read the code, read the forums, searched but didn’t find enough to answer my question.

Oh and I also clicked on update after changing the categories.

Also, the report is building itself from one of the categories that has this code inside the choice section:

Synthèse météo / Changements à l'ancien scénario : Synthèse météo / Changements à l'ancien scénario<font color=#00B0F0><b> (Surveillant)</b></font>
Distribution des tâches : Distribution des tâches<font color=#00B0F0><b> (Surveillant)</b></font>
WWCN70 : WWCN70<font color=#00B0F0><b> (Temps Violent)</b></font>
WOCN70 : WOCN70<font color=#00B0F0><b> (Temps Violent)</b></font>
Aperçu Convectif / Temps Significatif : Aperçu Convectif /Temps Significatif
Vigilance J1-2(Confiance-basse-modérée-haute & Impacts possibles) : Vigilance J1-2(Confiance-basse-modérée-haute & Impacts possibles)
Vigilance J3-5+(Confiance-basse-modérée-haute & Impacts possibles) : Vigilance J3-5+(Confiance-basse-modérée-haute & Impacts possibles)
Évaluation des modèles [tendances] : Évaluation des modèles [tendances]<font color=#00B0F0><b> (Temps Violent)</b></font>
71 : 71
72 : 72
73 : 73
74 : 74
75/WWCN75 : 75/WWCN75
Maritime Court-Terme : Maritime Court-Terme
Maritime Long-Terme : Maritime Long-Terme
Qualité de l'air/CAS : Qualité de l'air/CAS
Appels : Appels<font color=#00B0F0><b> (Surveillant/Temps Violents)</b></font>
Problèmes : Problèmes<font color=#00B0F0><b> (Surveillant/Temps Violents)</b></font>
Commentaires : Commentaires<font color=#00B0F0><b> (Surveillant/Temps Violents)</b></font>
Twitter/Facebook : Twitter/Facebook
1-900 : 1-900<font color=#00B0F0><b> (NE/NO la nuit)</b></font>
Climatologie : Climatologie
Tableau Cog : Urgences Environnementales<font color=#00B0F0><b> (Surveillant)</b></font>

You can see that the last line have both Tableau Cog and Urgences Environnementales at the same time. I suppose it’s done so they use the old variable to with the new name.

I have no idea on how to do this. Please help if you have an idea. I’ll continue searching for the answer and trying all I can.

Thanks for your help to all of you.

Have a nice day.

PS: If my question is not clear please tell me.
PPS: I added PHP and MySQL in the tags as it may also be a problem in the code/database.

Read more here: WordPress not showing a category with ACF


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , ,

Wordpress related questions and answers: