Plugin Options not being output

Basically, you’re not using the correct option name.

In your viptips_settings_init() function, you use the name viptips_settings as the database option name when registering the setting:

// The syntax is: register_setting( '<settings group name>', '<database option name>' )
register_setting( 'pluginPage', 'viptips_settings' );

So WordPress will use that viptips_settings when saving the option (i.e. update_option( 'viptips_settings', '<value>' )) and therefore you would also use the same name when getting the option from the database, regardless if the option is an array of values or just a single value:

  • The input with an array of values:

    <input type="text" name="viptips_settings[viptips_category_name]" ...>
    <input type="number" name="viptips_settings[viptips_postperpage]" ...>
    
  • The input with a single value:

    <input type="text" name="viptips_settings" ...>
    

So for example without using the $category_name and $postperpage variables, you could do something like (but make sure the array keys/items are actually set):

$options = (array) get_option( 'viptips_settings' );

$args = array(
    'post_type'     => 'post',
    'post_status'   => 'publish',
    'category_name' => $options['viptips_category_name'],
    'post_per_page' => $options['viptips_postperpage']
);

And if you had these in your code:

  • PHP

    // Here we've got two different database option names.
    register_setting( 'pluginPage', 'viptips_category_name' );
    register_setting( 'pluginPage', 'viptips_postperpage' );
    
  • HTML (in the form)

    <!-- And here two different input names; both not array -->
    <input type="text" name="viptips_category_name" ...>
    <input type="number" name="viptips_postperpage" ...>
    

Then your code, or this, would work:

$category_name = get_option( 'viptips_category_name' );
$postperpage = get_option( 'viptips_postperpage' );

So I hope this (revised) answer helps you (more) and others as well. 🙂