[wp-trac] [WordPress Trac] #37542: Taxonomies in cron jobs cause problems
WordPress Trac
noreply at wordpress.org
Tue Aug 2 10:38:33 UTC 2016
#37542: Taxonomies in cron jobs cause problems
-------------------------------+------------------------------
Reporter: blatan | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 4.5.3
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses:
-------------------------------+------------------------------
Comment (by blatan):
Wwe register taxonomies with this function:
{{{
public function init()
{
register_taxonomy($this->taxonomy_key, $this->object_type,
$this->getArgs());
if (count($this->default_terms)) {
foreach ($this->default_terms as $term) {
wp_insert_term($term, $this->taxonomy_key);
}
}
}
}}}
To reproduce the problem:
{{{
function abp_daily_callback() {
update_option('abp_daily_callback', date('Y-m-d H:i'));
MyImporter::importTermsFromExternalDb();
}
// in MyImporter class
public static function importTerms() {
// get $termSlug and $taxonomyName from external DB to check if it
exists in my DB
$term = get_term_by('slug', $termSlug, $taxonomyName, ARRAY_A);
// $term returned from get_term_by is set to invalid because
taxonomy_exists returns false
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37542#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list