[wp-hackers] Fatal error: Call to undefined function wp_insert_category() in ....
Haluk Karamete
halukkaramete at gmail.com
Fri Apr 6 01:00:08 UTC 2012
Dion, for a moment I had gotten excited - until I got stopped by the login
box - which I cannot beat!
current code is as follows now;
<?php
error_reporting (E_ALL);
// I did not need to change the paths cause it works this way already!
cause echo bloginfo() still works!
$full_path_to_wp_header = "F:\inetpub\wwwroot\....\wp-load.php";
include ($full_path_to_wp_header);
$full_path_to_wp_admin = "F:\inetpub\wwwroot\...wp-admin\admin.php";
include ($full_path_to_wp_admin);
define('WP_USE_THEMES', false);
echo bloginfo();
//this STILL reports the blog title properly!
$cat_defaults = array(
'cat_name' => 'Religion',
'category_description' => '',
'category_nicename' => '',
'category_slug' => 'Religion',
'category_parent' => '' );
//THIS LINE NOW FORCES A LOGIN
$my_cat_id = wp_insert_category( $cat_defaults );
/*
and I cannot pass the login screen!
every time I try to login, it redirects back to the login screen.
I can login with the same uid/password on a different browser so it's
definitely not a bad uid/pwd combination
I noticed that wp_insert_category forces the login url as follows
http://mysite.com/ic2/wp-login.php?redirect_to=http%3A%2F%2Fmysite.com%2Fic2%2Fblueprint%2Fpages%2Ftest.php&reauth=1
I can login if I change the url to plain jane style
http://mysite.com/ic2/wp-login.php
I guess wp_insert_category not gonna allow me to insert it from a stand
alone page?
What's wrong here?
*/
?>
On Thu, Apr 5, 2012 at 5:36 PM, Dion Hulse (dd32) <wordpress at dd32.id.au>wrote:
> 3 points.
>
> 1. Windows paths need to be written as F:\\inetpath\\ or F:/inetpath/ etc
> 2. Always include wp-load.php instead of wp-config or wp-blog-header
> for stand along scripts
> 3. wp_insert_category() is an admin function, you must also load the
> administrative functions by including wp-admin/admin.php
>
>
> On 6 April 2012 10:27, Haluk Karamete <halukkaramete at gmail.com> wrote:
> > I run the following function in a standalone php file.
> >
> > $cat_defaults = array(
> > 'cat_name' => 'Religion',
> > 'category_description' => '',
> > 'category_nicename' => '',
> > 'category_slug' => 'Religion',
> > 'category_parent' => '' );
> >
> > $my_cat_id = wp_insert_category( $cat_defaults );
> >
> > and this comes back with
> >
> > Fatal error: Call to undefined function wp_insert_category() in ....
> >
> >
> > The php file has the following on top!
> >
> > <?php
> >
> > error_reporting (E_ALL);
> >
> > $which_wordpress = "/ic2";
> >
> > $full_path_to_wp_header =
> "F:\inetpub\wwwroot\whatever\wp-blog-header.php";
> >
> > include ($full_path_to_wp_header);
> >
> > define('WP_USE_THEMES', false);
> >
> > echo bloginfo(); //this DOES report the blog title! I thought this was
> the
> > proof that whole wordpress she-bang loaded! I guess I'm wrong!
> >
> > ?>
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list