Remove modified date code in insert_post #288

Merged
merged 2 commits into from Jun 3, 2014

Projects

None yet

4 participants

@rmccue
WordPress REST API Team member

Turns out WP doesn't actually let us set this. Damn.

Fixes #285.

@rmccue rmccue Remove modified date code in insert_post
Turns out WP doesn't actually let us set this. Damn.
8bbf363
@rmccue rmccue added this to the 1.1 milestone Jun 3, 2014
@rmccue
WordPress REST API Team member

@rachelbaker #reviewmerge

@rachelbaker rachelbaker was assigned by rmccue Jun 3, 2014
@rachelbaker
WordPress REST API Team member

@rmccue Your code looks good. Please review my routes doc edit.
#reviewmerge

@rachelbaker rachelbaker added Has Patch and removed Has Patch labels Jun 3, 2014
@rachelbaker rachelbaker assigned rmccue and unassigned rachelbaker Jun 3, 2014
@rmccue rmccue merged commit 2b0cb99 into master Jun 3, 2014

1 check passed

Details continuous-integration/travis-ci The Travis CI build passed
@rmccue rmccue deleted the remove-modified-insert branch Jun 3, 2014
@rmccue
WordPress REST API Team member

🐦

@thebrandonallen

FWIW it can be done, but it's clumsy. Depends on how bad you want it.

@rmccue
WordPress REST API Team member

FWIW it can be done, but it's clumsy. Depends on how bad you want it.

Indeed, we'd have to do a raw $wpdb->update() call, which isn't something we should do.

@thebrandonallen

You can actually filter 'wp_insert_post_data' which comes after WP forces it's own modified/modified_gmt. It's used in one of the approaches in https://bbpress.trac.wordpress.org/ticket/1925.

@rmccue
WordPress REST API Team member

Oh, nice! That's less hacky than wpdb, but still a bit hacky in my opinion. I'm happy to just disallow API clients from setting the modified date (as it also hinders accountability).

@thebrandonallen

Agreed. Just wanted to make sure you were aware, in case it was something you really wanted.

@TimothyBJacobs

It would be incredibly helpful though. Especially in a scenario where you are on a custom ios app and want to make a change that would be bandwidth intensive. Being able to hold that post until your device comes into wifi perhaps, and then posting the updates to the server whilst still retaining the true modified date.

@rmccue
WordPress REST API Team member

It would be incredibly helpful though. Especially in a scenario where you are on a custom ios app and want to make a change that would be bandwidth intensive. Being able to hold that post until your device comes into wifi perhaps, and then posting the updates to the server whilst still retaining the true modified date.

Right; I see arguments for both cases. The fact that we expose it but don't allow updating it kind of sucks.

That said, working around WP's internals is a bad solution, and could also break both core code and plugins. The WP admin doesn't do it for delayed posts (that is, when your connect drops and saving is delayed until your connection comes back), so any solution should apply across the two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment