• We are running WordPress 5.4 and posts are not expiring. Is this compatible with 5.4 or are there any known issues/bugs?

Viewing 4 replies - 1 through 4 (of 4 total)
  • I can’t help but I am having the same problem as well as Scheduling posts not working. It maybe a problem with wp-cron and my server but my provider is still investigating.

    Regards,

    Derek

    I am also having this problem. I turned on the debugging for the plugin and I can see the CRON events set up to expire the posts, but those times pass and the posts are not expired.

    On my install, I see the CRON events running, and I have debug turned on. I can confirm it’s running. I trying to expire a custom post type, and the ExpireType (Draft, Trash, etc.) does not seem to be set when the expire function reads the ExpireType from the database.

    I see a few issues going on…
    In the postExpiratorExpire() function, these lines run to retrieve the Expire Type:

    	$postoptions = get_post_meta($id,'_expiration-date-options',true);
    	extract($postoptions);

    This options field is a serialized strong that looks like this:
    a:2:{s:10:”expireType”;s:5:”draft”;s:2:”id”;i:1123;}

    However that extract function does not seem to be putting the Expire Type value into the $expireType as the code clearly expects.

    So instead $expireType is empty so nothing happens and the posts are never expired.

    For custom post types (anything other than a post or page, there is a filter “postexpirator_custom_posttype_expire” which runs for custom post types without a proper expireType stored in the post meta field “_expiration-date-options”

    So I added this function that fixed my problem by setting the “expireType” to be “draft” for “product” CPT records (other valid values are “private”, “delete”, “trash, “stick”, “unstick”, “category”, “category-add”, or “category-remove”.

    function ayg_set_product_expire_action( $expireType, $posttype ) {
        if ( 'product' == $posttype ) {
            $expireType = 'draft';
        }
        return $expireType;
    }
    add_filter( 'postexpirator_custom_posttype_expire', 'ayg_set_product_expire_action', 10, 2 );

    It looks like for Posts, that when the expireType is missing that it used “Draft”, but the later code is expecting “draft” (all lowercase). So this may be causing expiration of posts to fail as well, however there is no filter hook on this value, so the above hook will not work. You could edit the plugin directly as a short term fix. Hopefully this gets addressed in a future version though.

    I had this issue with wp-cron not running. My webhost Zen Internet advised me to add define(‘DISABLE_WP_CRON’, false); to my wp-config.php and this cured the problem.

    Hope this might help.

    Best wishes,

    Derek

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Posts not expiring’ is closed to new replies.