File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,21 +27,25 @@ public function register() {
2727 add_filter (
2828 'jetpack_sync_before_send_jetpack_published_post ' ,
2929 function ( $ data ) {
30- if ( is_array ( $ data ) ) {
31- foreach ( $ data as $ key => &$ value ) {
32- if ( $ value instanceof \WP_Post ) {
33- if ( ! empty ( $ value ->post_content ) ) {
34- $ value ->post_content = Optml_Main::instance ()->manager ->replace_content ( $ value ->post_content );
35- }
36-
37- if ( ! empty ( $ value ->post_excerpt ) ) {
38- $ value ->post_excerpt = Optml_Main::instance ()->manager ->replace_content ( $ value ->post_excerpt );
39- }
40-
41- if ( isset ( $ value ->featured_image ) && ! empty ( $ value ->featured_image ) ) {
42- $ value ->featured_image = apply_filters ( 'optml_content_url ' , $ value ->featured_image );
43- }
44- }
30+ if ( ! is_array ( $ data ) ) {
31+ return $ data ;
32+ }
33+
34+ foreach ( $ data as &$ value ) {
35+ if ( ! $ value instanceof \WP_Post ) {
36+ continue ;
37+ }
38+
39+ if ( ! empty ( $ value ->post_content ) ) {
40+ $ value ->post_content = Optml_Main::instance ()->manager ->replace_content ( $ value ->post_content );
41+ }
42+
43+ if ( ! empty ( $ value ->post_excerpt ) ) {
44+ $ value ->post_excerpt = Optml_Main::instance ()->manager ->replace_content ( $ value ->post_excerpt );
45+ }
46+
47+ if ( isset ( $ value ->featured_image ) && ! empty ( $ value ->featured_image ) ) {
48+ $ value ->featured_image = apply_filters ( 'optml_content_url ' , $ value ->featured_image );
4549 }
4650 }
4751
You can’t perform that action at this time.
0 commit comments