Call to undefined function wp_create_category()
-
Hello,
I’m sorry, I speak a little English.
My custom theme:
~/wp-content/themes/mycustomtheme/functions.php
function mct_task() { include( get_template_directory() . '/inc/cron.php' ); } add_action( 'mct_hook', 'mct_task' ); // function mytheme_setup_options() { if( ! wp_next_scheduled( 'mct_hook' ) ) { wp_schedule_event( time(), 'hourly', 'mct_hook' ); } else {} } add_action( 'after_switch_theme', 'mytheme_setup_options' );~/wp-content/themes/mycustomtheme/inc/cron.php
$category_id = wp_create_category( 'Super' ); // $my_post = array( 'post_category'=> array( $category_id ) ); wp_insert_post( $my_post );~/error_log
PHP Fatal error: Uncaught Error: Call to undefined function wp_create_category() in...Why? What is the problem?
I would like use category at wp_insert_post with wp-cron. If the category exists, use the category ID, if not exists, create new category.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Call to undefined function wp_create_category()’ is closed to new replies.