[wp-trac] [WordPress Trac] #22102: Tags list not displaying programmatically added child tags
WordPress Trac
wp-trac at lists.automattic.com
Mon Oct 8 13:32:17 UTC 2012
#22102: Tags list not displaying programmatically added child tags
----------------------------+------------------------------
Reporter: capcar | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: 3.4.2
Severity: normal | Resolution:
Keywords: |
----------------------------+------------------------------
Comment (by capcar):
I'm grabbing keywords from an MSSQL database ($conn) and making them child
tags of a set of tags I've set up manually in Wordpress (those are the ID
numbers in the functions). Here's the basic code:
{{{
import_keywords($conn,'Business',10);
import_keywords($conn,'Entertainment',11);
import_keywords($conn,'Environment',12);
import_keywords($conn,'Finances',13);
import_keywords($conn,'House',14);
function import_keywords($conn,$legacyparent,$parent) {
if ($conn) {
$query = "Select * from Keyword where KeywordCategory = '"
. $legacyparent . "'";
$result = odbc_exec($conn,$query);
echo '<p>Getting keywords for <b>' . $legacyparent .
'</b>:<br />';
while(odbc_fetch_row($result))
{
$term =
odbc_result($result,"KeywordText");
wp_insert_term
($term,'post_tag',array('parent'=> $parent));
echo ' Keyword:
<strong>' . $term . '</strong> inserted as child of <strong>' .
$legacyparent . '</strong><br />';
};
odbc_close ($conn);
} else {
echo "odbc not connected";
};
};
}}}
The reproducible problem is that if I run all 5 of those functions at
once, then the child keywords of the last 4 functions will not appear in
the admin menu (even though they are in the database). However, if I run
each function independently and refresh the admin menu between each one,
then they all appear.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/22102#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list