Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into hotfix/wp-background-processing
  • Loading branch information
ziodave committed Mar 27, 2024
2 parents 92a92d3 + 6089e8f commit 86f4328
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/includes/class-wordlift-entity-type-service.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ public function set( $post_id, $type_uri, $replace = true ) {
* or `$term` was not found.
* @since 3.20.0
*/
private function get_term_by_slug( $slug ) {
public function get_term_by_slug( $slug ) {

return get_term_by( 'slug', $slug, Wordlift_Entity_Type_Taxonomy_Service::TAXONOMY_NAME );
}
Expand Down
7 changes: 6 additions & 1 deletion src/includes/class-wordlift-post-to-jsonld-converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ public function convert( $post_id, &$references = array(), &$references_infos =
// Get the entity name.
$jsonld['headline'] = $post->post_title;

$custom_fields = $this->entity_type_service->get_custom_fields_for_post( $post_id );
// Convert entities as `Article`.
//
// @see https://github.com/insideout10/wordlift-plugin/issues/1731
$custom_fields = Wordlift_Entity_Service::get_instance()->is_entity( $post_id )
? $this->entity_type_service->get_custom_fields_for_term( $this->entity_type_service->get_term_by_slug( 'article' ) )
: $this->entity_type_service->get_custom_fields_for_post( $post_id );

if ( isset( $custom_fields ) ) {
$this->process_type_custom_fields( $jsonld, $custom_fields, $post, $references, $references_infos );
Expand Down

0 comments on commit 86f4328

Please sign in to comment.