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

Dobromir Yordanov dyordan1 at ramapo.edu
Wed Dec 19 03:00:57 UTC 2012

Hi Haluk,

I'm sorry if I misunderstood you. If I got your idea right this time, how 
about you go through all pages/posts (perhaps doing some simple checks to 
sift through them) and publish them one by one? That really wouldn't be 
something you want to be doing regularly but if you have a process that does 
that once and you prevent the server from timing off, sure, why not. You can 
use the get_posts() or get_pages() functions to get a list of all of them 
(I'm not sure about that but I'm guessing that leaving that number of posts 
empty should default to no limit, as in all of the pages/posts so far). Then 
just do a loop that goes through the list of returned posts/pages and uses 
wp_publish_post($post->ID) to publish each one. You might have to do a 
wp_update_post() if that doesn't work since the codex specifically says 
"This function does not do anything except transition the post status." I 
hope this helps.


-----Original Message----- 
From: Haluk Karamete
Sent: Tuesday, December 18, 2012 6:19 PM
To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] what URL does the Dashboard's update button 

Thank you Dobri, but this would by pass the theme's hooks.
Perhaps I wasn't clear in my original post. Here, I'm NOT trying to
update the posts programmatically.
Those posts ( and they are 16k in count ) were all inserted into
wp_posts thru a migration routine that I wrote.
Once the routine finishes, I get to populate an empty wp_posts,
post_meta, term_taxonomy, terms, term_relationships and  comments with
all the content I want. Then I browse the site. Everything is alright
except some of the thumbnail images. some images show dithered, and
some shows just wrong - instead of showing the first image in the
post, it shows the last image. This feature is part of the theme I'm
working with. But whatever the problem is with those thumbs, they
simply get automatically fixed as soon as I open one of those posts
and hit the blue update button. Then the same post which used to show
the dithered image or the last image gets automatically fixed once and
for all.

It is because this reason why I wanted to "simulate" the click even on
that update.

If I adopt the actoin hooks or use wp_update_post etc, this does not
solve the problem.

I think there are a bunch of hooks that this theme registered and they
all kick in at the time of a manual update. See what I mean?

Can you suggest a away to stop the redirect before it ends up with
something like /wp-admin/post.php?post=3223&action=edit&message=1

If I could stop the location redirect, I think I should be able to see
the WordPress URL that's triggered upon clicking on the update button
on the dashboard.

On Tue, Dec 18, 2012 at 6:21 AM, Dobri <dyordan1 at ramapo.edu> wrote:
> 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
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
wp-hackers mailing list
wp-hackers at lists.automattic.com

More information about the wp-hackers mailing list