Skip to content

Commit

Permalink
Use instanceof in place of is_a().
Browse files Browse the repository at this point in the history
  • Loading branch information
peterwilsoncc authored Dec 13, 2023
1 parent 1ad018e commit 9f258cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion docs/snippets.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ add_filter( 'dt_push_post_args', function( $post_body, $post, $args, $connection

// When pushing to an external connection, we use the REST API, so the name of the field is `date`.
// But when pushing to an internal connection, the attributes are sent to wp_insert_post, which expects `post_date`.
$field_prefix = is_a( $connection, 'Distributor\ExternalConnections\WordPressExternalConnection' ) ? '' : 'post_';
$field_prefix =( $connection instanceof \Distributor\ExternalConnections\WordPressExternalConnection ) ? '' : 'post_';

$post_body[ $field_prefix . 'date'] = $post->post_date;
$post_body[ $field_prefix . 'date_gmt'] = $post->post_date_gmt;
Expand Down

0 comments on commit 9f258cc

Please sign in to comment.