【发布时间】:2014-03-13 13:46:11
【问题描述】:
我正在使用 Wordpress 中的管理页面来保存我的自定义设置。现在我想添加一个提交按钮,我可以在其中一次插入一些页面。
我无法在我的 Wordpress 管理员中提交这样的内容。我通过在提交后回显“测试”进行了一个简单的测试,但我没有得到任何输出。有人可以帮我解决这个问题吗?
这是我的代码:
<?php function stn_gen_settings() { ?>
<form method="post" action="options.php">
<div class="stn_divide">
<fieldset>
<h3><?php _e( 'Set account pages' ); ?></h3>
<?php
// Insert account pages
if( isset( $_POST['set_account_pages'] ) ) {
echo 'test';
$account_page = array(
'post_title' => 'Test page',
'post_content' => '[test_shortcode]',
'post_type' => 'account',
);
$page_id = wp_insert_post( $account_page );
}
?>
<?php submit_button( __( 'Set account pages' ), 'secondary', 'set_account_pages', $wrap, $other_attributes ) ?>
</fieldset>
</div><!--End stn_divide-->
</form>
<?php }
add_menu_page( '639Listings', '639Listings', 'manage_options', 'stn_general', 'stn_gen_settings' );
?>
【问题讨论】:
标签: php wordpress request admin