WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#14956 closed defect (bug) (invalid)

Fatal Error: add_meta_box

Reported by: javiertoledos Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.1
Component: Plugins Keywords: fatal error add_meta_box
Focuses: Cc:

Description

I got this error when I was writting a plugin

Fatal Error: Call to undefined function add_meta_box()

I'm calling the function from the main plugin's php file and I had no problems with other wordpress functions, I've copied a sample code from Wordpress codex but it didn't worked. I read some post that said in wordpress 3.01 the problem was fixed but I'm using that version.

Sorry for my bad english.

Change History (1)

comment:1 scribu4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

The file that contains add_meta_box() is not loaded at that point.

You need to hook into 'admin_menu' like the Codex suggests or even better in 'add_meta_boxes'.

Note: See TracTickets for help on using tickets.