added null check fro post_meta_time getter
This commit is contained in:
parent
b78bbbe372
commit
5cc9c35811
1 changed files with 3 additions and 0 deletions
|
@ -121,6 +121,9 @@ abstract class Base { // todo renmae to Base_tranformer
|
|||
*/
|
||||
public function get_post_meta_time( string $key ) {
|
||||
$time = $this->get_post_meta( $key, true ); // todo what if not exists
|
||||
if ( null === $time ) {
|
||||
return null;
|
||||
}
|
||||
$time = \strtotime( $time );
|
||||
return \gmdate( $this->timeformat, $time );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue