Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

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...

share|improve this question
add comment

1 Answer

    <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.

share|improve this answer
add comment

Your Answer

 
discard

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.