Register page in admin area

Ok, so I have a table in my admin area for my plugin. Each row as an edit button, which should post to the edit page. I don’t know how to add my php edit page to the registered wordpress page, though, so I don’t know what to put for action in the form.

        <td><form action="[edit.php]" method="post">
                <input type="hidden" id="<?php echo $issue->id?>" name="id" value="1">
                <input type="submit" value="Edit">
            </form>
        </td>

So what should I put inside the brackets (and yes, I will remove the brackets), and where/how do I add edit.php so wordpress knows it exists?

Read More

UPDATE: So apparently I just add edit.php normally, but specify null for its parent. Stil no idea what to put in those brackets.

UPDATE 2: Apparently the function I was looking for was menu_page_url…

Related posts

Leave a Reply

1 comment

  1.     <td><form action="<?php menu_page_url('edit') ?>" method="post">
                <input type="hidden" id="<?php echo $issue->id?>" name="id" value="1">
                <input type="submit" value="Edit">
            </form>
        </td>
    

    Then, in the function where you add your admin pages:

        add_submenu_page( null, 'edit', 'Edit', $capability, 'edit', 'create_edit');
    

    Also add this function:

    function create_edit(){
        include 'edit.php';
    }
    

    It would probably be a good thing to have more unique names than these.