Ah, I solved it! The problem was that outside of the admin panel WP does not load wp-admin
. The solution was to add
if (!is_admin()) {
require_once(ABSPATH . 'wp-admin/includes/post.php');
}
Now it works like a charm! 🙂
Ah, I solved it! The problem was that outside of the admin panel WP does not load wp-admin
. The solution was to add
if (!is_admin()) {
require_once(ABSPATH . 'wp-admin/includes/post.php');
}
Now it works like a charm! 🙂