Make WordPress Core

Opened 14 months ago

Closed 13 months ago

Last modified 13 months ago

#23705 closed defect (bug) (worksforme)

get_terms with ajax_nopriv_ return empty array

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


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 14 months ago.
code which produce the error
ajax.js (599 bytes) - added by squallbreizh 14 months ago.

Download all attachments as: .zip

Change History (5)

squallbreizh14 months ago

code which produce the error

comment:1 SergeyBiryukov14 months 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.

squallbreizh14 months ago

comment:2 netagence13 months 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,


comment:3 ocean9013 months ago

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