diff --git a/includes/admin/abstract/class-rop-services-abstract.php b/includes/admin/abstract/class-rop-services-abstract.php index 4d5e96267..3a04bb761 100644 --- a/includes/admin/abstract/class-rop-services-abstract.php +++ b/includes/admin/abstract/class-rop-services-abstract.php @@ -346,10 +346,14 @@ protected function get_url( $post_details ) { return ''; } - if ( empty( $post_details['short_url'] ) || empty( $post_details['short_url_service'] || 'wp_short_url' === $post_details['short_url_service'] ) ) { + if ( empty( $post_details['short_url'] ) || empty( $post_details['short_url_service'] ) ) { return ' ' . $post_details['post_url']; } + if ( 'wp_short_url' === $post_details['short_url_service'] ) { + return ' ' . wp_get_shortlink( $post_details['post_id'] ); + } + $post_format_helper = new Rop_Post_Format_Helper(); return ' ' . $post_format_helper->get_short_url( $post_details['post_url'], $post_details['short_url_service'], $post_details['shortner_credentials'] ); diff --git a/includes/admin/helpers/class-rop-post-format-helper.php b/includes/admin/helpers/class-rop-post-format-helper.php index f324d1d55..91c41f357 100644 --- a/includes/admin/helpers/class-rop-post-format-helper.php +++ b/includes/admin/helpers/class-rop-post-format-helper.php @@ -1033,8 +1033,7 @@ public function build_image( $post_id ) { * * @return string */ - public function get_short_url( $url, $short_url_service, $credentials = array() ) { - $shortner_factory = new Rop_Shortner_Factory(); + public function get_short_url( $url, $short_url_service, $credentials = array() ) { try { $shortner_service = $shortner_factory->build( $short_url_service );