Php 如何链接到WordPress中的设置页面?
我正在创建一个WordPress插件。我有一个使用Php 如何链接到WordPress中的设置页面?,php,wordpress,Php,Wordpress,我正在创建一个WordPress插件。我有一个使用admin\u菜单创建的设置页面action 在使用admin\u菜单注册的函数处理程序中,我有一些代码要解析$\u GET变量: if ($_GET['action'] === "create") { ... // display form to save a new object } 我的问题是,如何创建链接以链接到此表单? 基本上,我想链接到我的设置页面,并将action=create作为查询参数传递 更新 以下是更多相关代码: publ
admin\u菜单创建的设置页面
action
在使用admin\u菜单注册的函数处理程序中,我有一些代码要解析$\u GET
变量:
if ($_GET['action'] === "create") {
... // display form to save a new object
}
我的问题是,如何创建链接以链接到此表单?
基本上,我想链接到我的设置页面,并将action=create
作为查询参数传递
更新
以下是更多相关代码:
public static function zrdn_recipe_indexes()
{
wp_enqueue_style("bootstrap-3", ZRDN_PLUGIN_URL . '/vendor/twbs/bootstrap/dist/css/bootstrap.min.css');
if ($_SERVER['REQUEST_METHOD'] === 'GET')
{
switch($_GET['action'])
{
case "create":
{
self::create_index_page();
break;
}
default: // list
{
$indexes = self::get_indexes();
self::view('recipe_indexes/list', array(
"recipe_indexes" => $indexes
));
}
}
}
}
public static function zrdn_menu_pages() {
...
$recipe_indexes_page_title = "Recipe Indexes";
$recipe_indexes_menu_title = $recipe_indexes_page_title;
$recipe_indexes_menu_slug = "zrdn-recipe-indexes";
$recipe_indexes_page_renderer = array('Recipes', 'zrdn_recipe_indexes');
add_submenu_page(
$menu_slug, // parent_slug
$recipe_indexes_page_title, // page_title
$recipe_indexes_menu_title, // menu_title
$capability, // capability
$recipe_indexes_menu_slug, // menu_slug
$recipe_indexes_page_renderer // callback function
);
}
add_action('admin_menu', array('MyClass', 'zrdn_menu_pages' ));
你能添加你的全部代码吗?@KaushaMehta,更新了更多代码。试图链接到案例“create”:
部分。@davidcondrey,如何获取最后一个参数:$old\u query\u或\u uri
?您能添加您的全部代码吗?@KaushaMehta,用更多代码更新。试图链接到案例“create”:
部分。@davidcondrey,如何获取最后一个参数:$old\u query\u或\u uri
?