• Hello,

    I noticed the following in debug.log when I saved any other custom post type or post/page other than the forum/topic cpts;
    [14-Jun-2016 20:19:05 UTC] PHP Notice: Undefined index: str-bbpress-topic-sort-replies in /home/ljlee/public_html/wp-content/plugins/bbpress-sort-topic-replies/bbPress_sort_topic_replies.php on line 190
    [14-Jun-2016 20:19:05 UTC] PHP Notice: Undefined index: str-bbpress-topic-sort-replies in /home/ljlee/public_html/wp-content/plugins/bbpress-sort-topic-replies/bbPress_sort_topic_replies.php on line 192
    [14-Jun-2016 20:19:05 UTC] PHP Notice: Undefined index: str-bbpress-sort-replies in /home/ljlee/public_html/wp-content/plugins/bbpress-sort-topic-replies/bbPress_sort_topic_replies.php on line 199
    [14-Jun-2016 20:19:05 UTC] PHP Notice: Undefined index: str-bbpress-sort-replies in /home/ljlee/public_html/wp-content/plugins/bbpress-sort-topic-replies/bbPress_sort_topic_replies.php on line 201
    [14-Jun-2016 20:19:05 UTC] PHP Notice: Undefined index: str-bbpress-sort-replies-show-lead-topic in /home/ljlee/public_html/wp-content/plugins/bbpress-sort-topic-replies/bbPress_sort_topic_replies.php on line 208
    [14-Jun-2016 20:19:05 UTC] PHP Notice: Undefined index: str-bbpress-sort-replies-show-lead-topic in /home/ljlee/public_html/wp-content/plugins/bbpress-sort-topic-replies/bbPress_sort_topic_replies.php on line 210
    [14-Jun-2016 20:19:05 UTC] PHP Notice: Undefined index: str-bbpress-sort-replies-show-lead-topic-forum in /home/ljlee/public_html/wp-content/plugins/bbpress-sort-topic-replies/bbPress_sort_topic_replies.php on line 217
    [14-Jun-2016 20:19:05 UTC] PHP Notice: Undefined index: str-bbpress-sort-replies-show-lead-topic-forum in /home/ljlee/public_html/wp-content/plugins/bbpress-sort-topic-replies/bbPress_sort_topic_replies.php on line 219

    This is due to the code being executed via save_post which runs on any CPT during save.
    To resolve replace the add_action on line 186 with two add_actions one for each CPT that uses this functionality (ie. forum and topic);
    add_action( ‘save_post_forum’, ‘bbPress_meta_box_save’ );
    add_action( ‘save_post_topic’, ‘bbPress_meta_box_save’ );

    By specifying the post_type in the save_post action we don’t need to do a check before working with $_POST attributes that the plugin expects.

    Thank you

    https://wordpress.org/plugins/bbpress-sort-topic-replies/

  • The topic ‘Errors when saving other post types’ is closed to new replies.