You are here:  » Call to undefined function wp_create_category

Active Forum Topics


Call to undefined function wp_create_category

Submitted by DVDAFFAIRES on Mon, 2019-02-04 09:15 in

Hi David :)
Since a few days I have error messages in the log as follows:
---
mod_fcgid: stderr: PHP Fatal error: Uncaught Error: Call to undefined function wp_create_category() /wp-content/plugins/pto/pto_common.php:291
---

Would you have an idea?
Apparently the function does not exist?

Cheers,
raoul

Submitted by support on Mon, 2019-02-04 09:31

Hello Raoul,

That's strange - what WordPress version are you running?

You could try an alternative as wp_create_category is actually only a wrapper of wp_insert_category - to give that a go, edit pto_common.php and look for the following code at line 291:

  $post["post_category"] = array(wp_create_category($pto_productResults[0]->category));

...and REPLACE with:

  $post["post_category"] = array(wp_insert_category(array("cat_name"=>$pto_productResults[0]->category)));

Cheers,
David.
--
PriceTapestry.com

Submitted by DVDAFFAIRES on Mon, 2019-02-04 09:42

Hi David

I am using the latest version of WP - 5.03.
All plugins are up to date. None are obsolete.
It does it on all PT installations, with or without other plugins.

I made the modification and launched the CRON manually.
I do not have an error message yet.

I come back to you at the end of the day to confirm, I hope, the smooth operation.

Thank you very much David.

Cheers,
raoul