Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

afifnajib on "Adding category - AJAX interrupted"

$
0
0

Hello everyone.

I have a plugin called "Basic Google Maps Placemark" installed, and it uses a custom taxonomy called bgmp-category. What am I trying to do now, is whenever the user creates a new Posts category, a new bgmp-category taxonomy is automatically created.

This has done the job:

add_action( 'created_category',			array( $this, 'autoAddCategory' ) );

public function autoAddCategory($term, $taxonomy, $args = array()) {
	$addedTerm = get_term($term, 'category');
	return wp_insert_term($addedTerm->name, self::TAXONOMY, array('description' => $addedTerm->description, 'slug'=> $addedTerm->slug));
}

Unfortunately, now whenever I create a Posts category, the newly-created category does not show up on the list until I hit refresh, which means the AJAX somehow got interrupted because of my action hook.

What should I do?


Viewing all articles
Browse latest Browse all 8245

Trending Articles