Skip to content

Commit 6f2d763

Browse files
committed
remove get_transformed_post_id() since now meta key is exposed
1 parent 0462499 commit 6f2d763

File tree

3 files changed

+2
-18
lines changed

3 files changed

+2
-18
lines changed

src/plugin/class-post-type-ui.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ function () {
100100
global $post;
101101

102102
$post_id = $post->ID;
103-
$transformed_post_id = $this->transformer->get_transformed_post_id( $post_id );
103+
$transformed_post_id = get_post_meta( $post_id, Transformer::META_KEY_LIBERATED_OUTPUT, true );
104104

105105
if ( $transformed_post_id ) {
106106
echo '<pre>PostID: ' . esc_html( $transformed_post_id ) . '</pre>';

src/plugin/class-transformer.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@ private function get_post_type_for_transformed_post( int|WP_Post $liberated_post
3636
return apply_filters( 'post_type_for_transformed_post', $post_type, $liberated_post );
3737
}
3838

39-
public function get_transformed_post_id( $liberated_post_id ): int|null {
40-
$value = get_post_meta( $liberated_post_id, self::META_KEY_LIBERATED_OUTPUT, true );
41-
if ( '' === $value ) {
42-
return null;
43-
}
44-
45-
return absint( $value );
46-
}
47-
4839
public function transform( Subject $subject, string $verb ): bool {
4940
if ( apply_filters( 'skip_native_transformation', false ) ) {
5041
return true;

tests/plugin/test-transformer.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected function setUp(): void {
3434
protected function tearDown(): void {
3535
parent::tearDown();
3636

37-
$transformed_post_id = $this->transformer->get_transformed_post_id( $this->post_id_in_db );
37+
$transformed_post_id = get_post_meta( $this->post_id_in_db, Transformer::META_KEY_LIBERATED_OUTPUT, true );
3838
wp_delete_post( $transformed_post_id, true );
3939
wp_delete_post( $this->post_id_in_db, true );
4040

@@ -54,13 +54,6 @@ public function testGetPostTypeForTransformedPost() {
5454
$this->assertEquals( 'product', $result );
5555
}
5656

57-
public function testGetTransformedPost() {
58-
add_post_meta( 99, Transformer::META_KEY_LIBERATED_OUTPUT, 999 );
59-
60-
$this->assertEquals( 999, $this->transformer->get_transformed_post_id( 99 ) );
61-
$this->assertEquals( null, $this->transformer->get_transformed_post_id( 88 ) );
62-
}
63-
6457
public function testTransform(): void {
6558
$result = $this->transformer->transform( Subject::from_post( $this->post_id_in_db ), 'whatever' ); // verb isn't currently used
6659

0 commit comments

Comments
 (0)