Skip to content

How to use callback? #43

@luizlopescom

Description

@luizlopescom

Hello,
I'm having trouble to figure out how to use the callback. I already created a function, set 'custom' to true and set the 'callback' to the functions name. But, instead of running the function, the function's name is displayed as a notice message (below the page title).

This is the part of the code:

function awpha_bookmarks_test() {
	echo 'It works!';
}


$awpha_bookmarks_settings_page = array(
	'awpha_bookmarks_settings'	=> array(
		'parent_slug'	=> 'edit.php?post_type=awpha_bookmarks',
		'page_title'	=> __( 'Settings', 'awpha_bookmarks' ),
		'menu_slug '	=> 'awpha_bookmarks_settings',
		'sections'		=> array(
			//Setup
			'section-2'	=> array(
				'title'			=> __( 'Submit bookmark URL', 'awpha_bookmarks' ),
				'fields'		=> array(
					'frontend_url'		=> array(
						'id'			=> 'frontend_url',
						'title'			=> __( 'Frontend URL', 'awpha_bookmarks' ),
						'custom'		=> true,
						'callback'		=> 'awpha_bookmarks_test',
					),
				),
			),
		...extra code...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions