• Resolved jankowski

    (@jankowski)


    Could someone direct me towards the source code (or the function itself) that takes care of updating a post when the “Update Page” button is clicked on the page/post editor? I’m creating a page manually using a PHP script and wp_insert_post(), and the security settings that I’ve set using the plugin User Access Manager are not being applied. They are applied, however, when I go to the page editor and simply click the “Update Page” button. I would just like the code to do this instead of the WordPress interface.

    Unfortunately, including wp_update_post() or wp_publish_post in my code hasn’t worked thus far. Would any of you happen to know the function that is called when that button is pressed?

    Thanks so much, and apologies if this is the wrong forum!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Are you using the Settings API?

    Thread Starter jankowski

    (@jankowski)

    I haven’t looked at that yet! None of my searching on Google/WordPress took me to that page.

    I’d suggest you have a good read of that API. You might also want to look at http://ottopress.com/2009/wordpress-settings-api-tutorial/ This is the recommended way of interacting with WordPress via a 3rd party script.

    Thread Starter jankowski

    (@jankowski)

    I’m not necessarily looking to create separate settings or more options for the dashboard itself; I’m just trying to work around a certain plugin’s peculiarities and essentially to refresh/update a post immediately after it’s been created using wp_insert_post(). Do you know if there’s a particular function for the existing “Update” button that I can use in my code (without creating new tabs on the dashboard, etc.)?

    Moderator bcworkz

    (@bcworkz)

    Scripts run without capability restrictions. If a certain task should only be performed by certain users, it is your responsibility as a coder to check the user’s capabilities before performing a task. You may use current_user_can() for this.

    This is what the “Update” button action does (among other things) before calling wp_update_post() itself. There is no single function that does everything for you.

    Thread Starter jankowski

    (@jankowski)

    Fixed with wp_set_current_user()

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Manual update of post’ is closed to new replies.