I have the following situation - I'm making a WordPress version of a jQuery plugin and I want the users to be able to have multiple instances of the plugin (with unique content) for their site. On the main page of my plugin settings the user makes and deletes the instances of the plugin and they appear as dynamically generated submenu pages.

Here comes the trouble. In each submenu page there must be a form with settings for that specific instance. I'm doing my best to go with WP standards (so to speak) instead of custom stuff and I really want to try out the Settings API. I barely wrap my head around how to use it in a "normal" or static page, but what about those dynamically generated pages? What do I have to specify as a page when I register the settings section with add_settings_section()?

Also, I'm using the class approach for writing the entire thing, and honestly it's a mess. I have no idea where should I register those sections and fields. Here is my template for the plugin:

if (!class_exists('PluginName')) {
    class PluginName {
        function __construct() {

        function get_admin_options() {

        function init() {
            // Register plugin pages, subpages and stuff
        function print_admin_page() {


if (class_exists('PluginName')) {
    $pluginName = new PluginName();

if (isset($pluginName)) {
    add_action('admin_init', array($this, 'init'));

Any help is much appreciated.


  • Take a look at this series of articles wp.tutsplus.com/series/… Hope it will help you. – Eugene Manuilov Jun 1 '12 at 5:30
  • "...multiple instances of the Plugin..." - would it not be possible to wrap the Plugin in a Widget, to enable multiple instances? – Chip Bennett Jun 1 '12 at 12:38

I think the approach you're attempting is prohibitively complex, and will not scale well at all. I would suggest two possible alternatives to the approach you're trying to take:

  1. Create a Widget to display your Plugin output, so that the Widgets API handles the settings for multiple instances of your Plugin output.
  2. Create a Shortcode to output your Plugin, and follow the example of other Plugins, such as contact-form Plugins (Contact Form 7, Gravity Forms, etc.), regarding how to manage settings for multiple instances of your Plugin output.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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