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

Haluk Karamete halukkaramete at gmail.com
Tue Dec 18 23:19:41 UTC 2012


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


More information about the wp-hackers mailing list