Skip to content

Commit

Permalink
Merge pull request #1663 from xwp/fix/1662-fatal-error-unknown-format…
Browse files Browse the repository at this point in the history
…-specifier

Fatal Error Unknown Format Specifier
  • Loading branch information
marcinkrzeminski authored Dec 23, 2024
2 parents 7ffd0b2 + 62039e5 commit d37edf3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions connectors/class-connector-wordpress-seo.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,15 +407,18 @@ private function meta( $object_id, $meta_key, $meta_value ) {
}

$post = get_post( $object_id );
$post_type_label = get_post_type_labels( get_post_type_object( $post->post_type ) )->singular_name;
$post_type_obj = get_post_type_object( $post->post_type );
$post_type_label = is_object( $post_type_obj ) && isset( $post_type_obj->labels->singular_name )
? $post_type_obj->labels->singular_name
: $post->post_type;

$this->log(
sprintf(
/* translators: %1$s: a meta field title, %2$s: a post title, %3$s: a post type (e.g. "Description", "Hello World", "Post") */
__( 'Updated "%1$s" of "%2$s" %3$s', 'stream' ),
$this->escape_percentages( $field['title'] ),
$this->escape_percentages( $post->post_title ),
$this->escape_percentages( $post_type_label )
$this->escape_percentages( (string) $field['title'] ),
$this->escape_percentages( (string) $post->post_title ),
$this->escape_percentages( (string) $post_type_label )
),
array(
'meta_key' => $meta_key,
Expand Down

0 comments on commit d37edf3

Please sign in to comment.