[wp-hackers] what URL does the Dashboard's update button link to?

Dobri dyordan1 at ramapo.edu
Tue Dec 18 14:21:10 UTC 2012


Try to cause WordPress to wp_die(var_dump($_POST)); when a post is updated and check what the parameters passed to the post.php/edit.php page are when stuff gets published/edited/created/whatever.(I've posted some code below) Then you can just imitate those POST parameters to update pages programatically. Once you've played around with it enough, remove the code that kills wordpress and see if your imitation works. If there is some defense against this kind of behavior it might not work but at least it's worth a shot. And yes, I do realize it's not elegant at all.

function kill_it($new_status, $old_status, $post)
{
	//prevent from dying when attempting to create a new page
	if('new' != $old_status)
	{
		wp_die(var_dump($_POST));
	}
}

add_action('transition_post_status', 'kill_it', 10, 3);

Another solution might be to create a plugin that has its own custom page that takes GET/POST parameters and (sanitizes!) and uses those to create/edit pages through the wp_update_post() and wp_insert_post() functions. That would be a dash more elegant. I hope I helped at least a bit.

~Dobri

On Mon, 17 Dec 2012, at 4:24 PM, Haluk Karamete wrote:

> I would like to diagrammatically trigger the process which runs when
> an admin clicks on the blue "update" button on the dashboard.
> 
> I'm looking for something like
> 
> .... wp-admin/post.php?post=5095&action=publish
> .... wp-admin/post.php?post=5095&action=submit_publish something like that.
> 
> I assume that the link I'm looking for would trigger the same process
> which takes place upon  an update button click on the admin dashboard.
> 
> The plan is to use the define('WP_USE_THEMES', false); in a standalone
> PHP  and run that link in a loop. ( The particular theme I'm working
> with fixes certain problems that I encounter on my programmatically
> migrated posts upon  a simple update. Since I got to many to fix, thus
> to many to click on the update button manually. )
> 
> Back in the old days, you would be able to go to the view source, find
> that button, trace it to its href .
> Then you could run that href in a loop changing the postid's at each
> iteration and viola, all the posts referred  in the loop would have
> been updated - the same way a manual mouse click would do. Now, the
> click events are attached thru javascript, that's no longer the case.
> 
> Since I cannot see the href and a server level redirect takes place
> thru the operation, it's quite hard to get to it.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers


More information about the wp-hackers mailing list