WordPress.org

Ready to get started?Download WordPress

Forums

save_status_pre firing at wrong time (6 posts)

  1. PeteHoliday
    Member
    Posted 5 years ago #

    On line 497 of wp-admin/post.php the status_save_pre filter is applied. After that filter is applied, a number of things are done to the post status by post.php.

    Of specific interest to me is the fact that the "future" status will never be passed to status_save_pre filters because it's not determined to be "future" until after the post status is filtered.

    The post is only converted to "future" if it is a "published" post. "Private" posts do not get that treatment (I think this is the right way to do it), but I'm developing a plug-in to allow for private posts (wp-sentry) and this behavior is breaking future posts.

    The filter only gets "published" or "private" -- if the plugin forces the post from "published" to "private" it won't be set to "future".

    Better behavior would be to call the filter (or add another filter) before the post save to allow plugins to respect future posts and differentiate between them and other private posts.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    wp-admin/post.php does not have 497 lines. And I cannot find the text "status_save_pre" anywhere in the entire codebase.

    So... what exactly are you talking about?

  3. PeteHoliday
    Member
    Posted 5 years ago #

    Apparently I was looking at an older version of the source (and transposed 'status' and 'save'), but the point is still the same: the status filter is being called before WP decides what the final status should be.

    wp_insert_post calls sanitize_post on wp-admin/includes/post.php line 1224. sanitize_post calls sanitize_post_fields, which fires the status_save_pre filter.

    After all of that, WP decides if the post is "future" or not around line 1300.

    That filter either needs to be fired after the post status is actually determined by wordpress, or there should be a different filter fired that plugins can use what won't muck-up the future posting.

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    Tell it to trac. That's the proper place to report it.

  5. PeteHoliday
    Member
    Posted 5 years ago #

    It sounds to me like this behavior would get closed in trac because it's not a bug. 'If it is decided that your bug isn't in fact a bug, but is the intended behaviour, it will be closed with invalid.'

    What, exactly, is the point of this forum? (This question is mostly rhetorical as I have yet to find a moderator who can provide an even remotely helpful answer)

  6. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    These forums are for user-to-user support, mainly. If you think it's a valid bug in WP, then trac is the correct place to report it. Bug reports for WP itself don't really belong here.

    Your bug sounds valid enough to me. If the filter isn't filtering properly because it's reset later, then that's a bug.

Topic Closed

This topic has been closed to new replies.

About this Topic