@@ -1742,6 +1742,7 @@ function ( $attr, $key ) {
1742
1742
$ image_source_url = '' ;
1743
1743
$ img_success = true ;
1744
1744
$ new_post_id = 0 ;
1745
+ $ img_title = $ item ['item_title ' ];
1745
1746
$ feed_img_tag = ! empty ( $ import_featured_img ) && is_string ( $ import_featured_img ) ? $ import_featured_img : '' ;
1746
1747
1747
1748
// image tag
@@ -1765,10 +1766,11 @@ function ( $attr, $key ) {
1765
1766
}
1766
1767
} else {
1767
1768
$ image_source_url = $ feed_img_tag ;
1769
+ $ img_title = pathinfo ( basename ( $ image_source_url ), PATHINFO_FILENAME );
1768
1770
}
1769
1771
1770
1772
if ( ! empty ( $ image_source_url ) ) {
1771
- $ img_success = $ this ->try_save_featured_image ( $ image_source_url , 0 , $ item [ ' item_title ' ] , $ import_errors , $ import_info , $ new_post );
1773
+ $ img_success = $ this ->try_save_featured_image ( $ image_source_url , 0 , $ img_title , $ import_errors , $ import_info , $ new_post );
1772
1774
$ new_post_id = $ img_success ;
1773
1775
}
1774
1776
@@ -1850,8 +1852,9 @@ function( $term ) {
1850
1852
do_action ( 'feedzy_import_extra ' , $ job , $ item_obj , $ new_post_id , $ import_errors , $ import_info );
1851
1853
1852
1854
if ( ! empty ( $ import_featured_img ) && 'attachment ' !== $ import_post_type ) {
1853
- $ image_source_url = '' ;
1854
- $ img_success = true ;
1855
+ $ image_source_url = '' ;
1856
+ $ img_success = true ;
1857
+ $ img_title = $ item ['item_title ' ];
1855
1858
1856
1859
$ feed_img_tag = false === strpos ( $ import_featured_img , '[[{"value": ' ) ? $ import_featured_img : '[#item_image] ' ; // Use feed default image when we are using chained actions.
1857
1860
@@ -1874,6 +1877,7 @@ function( $term ) {
1874
1877
}
1875
1878
} elseif ( wp_http_validate_url ( $ import_featured_img ) ) {
1876
1879
$ image_source_url = $ import_featured_img ;
1880
+ $ img_title = pathinfo ( basename ( $ image_source_url ), PATHINFO_FILENAME );
1877
1881
}
1878
1882
1879
1883
// Fetch image from graby.
@@ -1920,7 +1924,7 @@ function( $term ) {
1920
1924
}
1921
1925
}
1922
1926
1923
- if ( 'yes ' === $ import_item_img_url || ! $ this ->tryReuseExistingFeaturedImage ( $ img_success , $ item [ ' item_title ' ] , $ new_post_id ) ) {
1927
+ if ( 'yes ' === $ import_item_img_url || ! $ this ->tryReuseExistingFeaturedImage ( $ img_success , $ img_title , $ new_post_id ) ) {
1924
1928
// Run chained actions.
1925
1929
$ import_featured_img = rawurldecode ( $ import_featured_img );
1926
1930
$ import_featured_img = trim ( $ import_featured_img );
@@ -1934,7 +1938,7 @@ function( $term ) {
1934
1938
update_post_meta ( $ new_post_id , 'feedzy_item_external_url ' , $ image_source_url );
1935
1939
} else {
1936
1940
// if import_featured_img is a tag.
1937
- $ img_success = $ this ->try_save_featured_image ( $ image_source_url , $ new_post_id , $ item [ ' item_title ' ] , $ import_errors , $ import_info );
1941
+ $ img_success = $ this ->try_save_featured_image ( $ image_source_url , $ new_post_id , $ img_title , $ import_errors , $ import_info );
1938
1942
}
1939
1943
}
1940
1944
}
0 commit comments