• Hi all,
    i’m new to plugin development for wordpress and i have a general question. I know this might not be the correct forum category, but i can’t post it into WP-Advanced section (only moderators can post there).

    The plugin i’m developing creates a couple of tables in the wordpress database (table1, table2). It also has a shortcode, named [myshortcode] which creates a simple form with a submit button. I’ve placed this shortcode into private posts/pages. In this way, only authenticated users will be able to see these posts/pages and submit the form. Once data are submitted, the values are inserted in the database tables.

    In the form tag, i’ve used the attribute: action=MY_PLUGIN_URL . "inc/readform.php". I’ve used that path in the action attribute because it makes sense to me that the submitted data should be processed by the plugin itself.
    In the plugin main folder (MY_PLUGIN_DIR), there is the file myplugin.php, where i’ve included all the php files store in the folder MY_PLUGIN_DIR/inc.

    The problem is: i’ve included all the functions that read/write the database into a file called function.db.php (stored in the same directory as readform.php). In order to update the data in the database, i need to use that functions inside the readform.php. But when i click submit i keep getting the error “Fatal error: Call to undefined function…”.
    I’ve even try to put include( 'functions.debug.php' ); to the top of readform.php, but doing this i get the error “Fatal error: Cannot redeclare the function …” when i load the page.

    What should i do to avoid this kind of errors?

  • The topic ‘submit data to plugin from private pages’ is closed to new replies.