• First of all what a great plugin.

    We did however notice some issues right away – none of the Category expiry methods were working even though the Debug Log was indicating that it was successful.

    We went ahead and had a look at the code in post-expirator.php and are happy to report that we were able to correct the bugs.

    Those of you having similar problems with the plugin can use the following 3 line replacements to correct issues with the category expiration methods:

    1) Replace Line 691:
    if (wp_update_post(array('ID' => $id, 'post_category' => $category)) == 0) {

    with:
    if (wp_set_post_categories($id, $category, false) == false) {

    2) Replace Line 722:
    if (wp_update_post(array('ID' => $id, 'post_category' => $merged)) == 0) {

    with:
    if (wp_set_post_categories($id, $merged, true) == false) {

    3) Replace Line 758:
    if (wp_update_post(array('ID' => $id, 'post_category' => $merged)) == 0) {

    with:
    if (wp_set_post_categories($id, $merged, false) == false) {

    What we’re doing here is using the wp_set_post_categories function to apply the categories, rather than the wp_update_post function used in the plugin, then checking whether it returns false rather than 0 after execution in the case of failure.

    We hope this helps some of you who may be experiencing similar issues.

    Cheers,
    Cameron
    Discotoast Inc.

Viewing 1 replies (of 1 total)
  • I’m having this exact problem, and these code changes did not solve it. Any other suggestions? Plugin worked fine, then didn’t. No changes or updates performed. Categories no longer get replaced even though the log indicates success.

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • The topic ‘Plugin Fixes: Category Replace, Add and Remove’ is closed to new replies.