piklist icon indicating copy to clipboard operation
piklist copied to clipboard

Suggested change for PikList_CPT::wp_insert_post_data()

Open basepack opened this issue 9 years ago • 1 comments

Hi guys,

When you are on a non-English WordPress, you can never use the filter: piklist_empty_post_title

Here is the function:

public static function wp_insert_post_data($data, $post_array)
  {
    if (($data['post_status'] != 'auto-draft') && (($data['post_title'] == 'Auto Draft') || empty($data['post_title'])))
    {
      $data['post_title'] = apply_filters('piklist_empty_post_title', $data['post_title'], $post_array);
    }

    return $data;
  }

Suggested change:

public static function wp_insert_post_data($data, $post_array)
  {
    $data['post_title'] = apply_filters('piklist_empty_post_title', $data['post_title'], $post_array);

    return $data;
  }

This is because $data['post_title'] == 'Automatische concepten' in for example Dutch.

It is nice to encapsulate filters, so they are not running all the time. But this one is unusable for all non-English Piklist users.

Thanks!

basepack avatar Apr 13 '16 07:04 basepack

Hi,

Any news on this one?

basepack avatar Apr 29 '16 07:04 basepack