Date format filter
-
Hi there,
since 2.0 the filter for changing the date format produces an error.
Uncaught Error: Call to a member function format() on null in XXXX\htdocs\XXXX\wp-content\themes\XXXX\functions.php:376 Stack trace: #0 XXXX\htdocs\XXXX\wp-includes\class-wp-hook.php(286): my_custom_sanitize_fields('13 December 197...', Array) #1 XXXX\htdocs\XXXX\wp-includes\plugin.php(203): WP_Hook->apply_filters('13 December 197...', Array) #2 XXXX\htdocs\XXXX\wp-content\plugins\ultimate-member\includes\um-short-functions.php(712): apply_filters('um_profile_fiel...', '1971/12/13', Array) #3 XXXX\htdocs\XXXX\wp-content\plugins\ultimate-member\includes\core\class-fields.php(661): um_filtered_value('birth_date', Array) #4 XXXX\htdocs\XXXX\wp-content\plugins\ultimate-member\includes\core\class-fields.php(3527): um\core\Fields->field_value('birth_date', NULL, Array) #5 XXXX\htdocs\XXXX\wp-content\plugins\ultimate-member\includes\core\class-fields.php(3855): um\core\Fields->view_field('birth_date', Array) #6 XXXX\htdocs\XXXX\wp-content\plugins\ultimate-member\includes\core\ in XXXX\htdocs\XXXX\wp-content\themes\XXXX\functions.php on line 376
I’m using:
add_filter('um_profile_field_filter_hook__date','my_custom_sanitize_fields', 9999, 2 ); function my_custom_sanitize_fields( $value, $data ){ global $ultimatemember; if( $data['metakey'] == 'birth_date' ){ $value = $ultimatemember->datetime->format( $value, "d.m.Y"); } return $value; }
It worked before the update. Someone an idea?
- The topic ‘Date format filter’ is closed to new replies.