WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this php Code to make a option page that activate a function if the user set "active" and turn off the function, if the user set "Not active".

add_action('admin_menu', 'custom');
function custom() {
add_menu_page('settings', 'settings', '8', 'custom', 'customfunc');
function customfunc(){
$wpp_rg = get_option('wpp_rg');
if ($_POST['submit']):
<div class="wrap">
<form action="" method="post">
<table width="70%" border="0" cellspacing="5" cellpadding="5">
        <th scope="row">test mode :</th>
                <input name="wpp_rg" type="radio" value="1" id="RadioGroup1_0" <?php echo ($wpp_rg==1 ? 'checked="checked"' : '') ?> />
         <br />
                <input name="wpp_rg" type="radio" value="2" id="RadioGroup1_1" <?php echo ($wpp_rg==2 ? 'checked="checked"' : '') ?>/>
                not active</label>
         <br />

        <td><input type="submit" name="wpp_submit" value="save" class="button" /></td>

$wpp_rg = get_option('wpp_rg');

/******************** IF1 ***********************/

if ($wpp_rg==1) {

echo "Active";

if ($wpp_rg==2) {

echo "Not Active";

/******************** IF1 ***********************/


But the problem is that, the html radios are not working ! when i click "not active " and save, nothing happen !

What is the problem ? ?

share|improve this question
Isn't it supposed to be if($_POST['wpp_submit'])? – gdaniel Mar 7 '14 at 21:32
@gdaniel not work again :( – user3394468 Mar 7 '14 at 21:38
You really need to sanitize your input and use nonces, you're just asking to get hit by a cross site scripting attack. – Andrew Bartel Mar 7 '14 at 21:59
You really need to be using the Settings API. – vancoder Mar 7 '14 at 22:36
@vancoder That too. – Andrew Bartel Mar 7 '14 at 22:49

I believe the problem could be with your add_menu_page() function.

You have your 3rd parameter set as '8' and that is a deprecated use of that particular parameter (capability). See:




You should try changing that to the correct string representation.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.