Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#23705 closed defect (bug) (worksforme)

get_terms with ajax_nopriv_ return empty array

Reported by: squallbreizh's profile squallbreizh Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.5
Component: General Keywords:
Focuses: Cc:

Description

When using the get_terms() function in an ajax function, get_terms() return an empty array.If the user is logged in, get_terms() actually returns a list of terms.

Attachments (2)

plugin.php (2.1 KB) - added by squallbreizh 12 years ago.
code which produce the error
ajax.js (599 bytes) - added by squallbreizh 12 years ago.

Download all attachments as: .zip

Change History (5)

@squallbreizh
12 years ago

code which produce the error

#1 @SergeyBiryukov
12 years ago

  • Keywords reporter-feedback added

Could you share your ajax.js file too?

Note that wp_enqueue_script() should be hooked to wp_enqueue_scripts action rather than called directly in the plugin body: http://codex.wordpress.org/Function_Reference/wp_enqueue_script.

@squallbreizh
12 years ago

#2 @netagence
12 years ago

  • Keywords close added
  • Status changed from new to closed

Based on my tests and the found solution (not workaround) I suggest this does *not* qualify as a bug. After investigating, we solved the issue by updating the rights in the

Roles > options > Realm > Post Type Usage

section. By unchecking the checkbox labelled "Realisations" we specified that this Custom Type could not have Restrictions and Roles. Once saved we got a properly working drop-down menu even for non logged-in users.
Rather a settings issue then, quite easy to get lost into given the huge features of WP, even more so once extented to permissions and custom types.

I hope this helps,

Pierre.

#3 @ocean90
12 years ago

  • Keywords reporter-feedback close removed
  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
Note: See TracTickets for help on using tickets.