WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#7752 closed defect (bug) (fixed)

is_admin() false inside admin-ajax.php

Reported by: Malaiac Owned by:
Milestone: 2.7 Priority: normal
Severity: minor Version: 2.6.1
Component: Administration Keywords: admin ajax
Focuses: Cc:

Description

tested :

// admin-ajax.php, start of file (after require_once)
if(is_admin()) echo 'is _admin';

won't work.

May harm some conditional dependencies, or plugin queries.

Change History (5)

comment:1 @DD327 years ago

define('DOING_AJAX', true);
define('WP_ADMIN', true);

require_once('../wp-load.php');
require_once('includes/admin.php');

	var_dump(is_admin());

if ( !is_user_logged_in() )
	die('-1');

results in 'boolean true' for me under 2.7, I dont have a 2.6.x checkout to test on though.

comment:2 @Malaiac7 years ago

  • Milestone set to 2.8

comment:3 @Malaiac7 years ago

same lines, give me boolean(false) on 2.6.2
but no 2.7 to test under.

let's say this bug has been fixed in trunk ?

comment:4 @azaozz7 years ago

  • Milestone changed from 2.8 to 2.7
  • Resolution set to fixed
  • Status changed from new to closed

Yes, in trunk it returns true.

comment:5 @Viper007Bond7 years ago

Shouldn't this be worksforme?

Note: See TracTickets for help on using tickets.