From 29258684d3eb87ae1206cfb132084b62423ce075 Mon Sep 17 00:00:00 2001 From: Jared Counts Date: Thu, 16 Jun 2022 09:42:51 -0500 Subject: [PATCH 01/15] Readme updates --- README.md | 1 + readme.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index db80cd3..04c8a5c 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ NPR Stories having got gotten ### V1.9.4 * Changed `nprstory_get_datetimezone()` to generate a new `DateTimeZone` off of the `timezone_string` WP option. The previous method tried to use `gmt_offset` in seconds, but `DateTimeZone` requires a string * Fixed an issue where inserted images in imported stories might have quotation marks in their alt tags +* Fixed an issue where images were being duplicated while sideloading (all credit to [@tamw-wnet](https://github.com/tamw-wnet) for the catch) [Issue #18](https://github.com/OpenPublicMedia/nprapi-wordpress/issues/18) ### V1.9.3.1 * Fixed bug that was preventing display of Simple Story elements in imported stories diff --git a/readme.txt b/readme.txt index 8f0fcd0..76db604 100644 --- a/readme.txt +++ b/readme.txt @@ -73,6 +73,7 @@ NPR Stories having got gotten = V1.9.4 = * Changed `nprstory_get_datetimezone()` to generate a new `DateTimeZone` off of the `timezone_string` WP option. The previous method tried to use `gmt_offset` in seconds, but `DateTimeZone` requires a string * Fixed an issue where inserted images in imported stories might have quotation marks in their alt tags +* Fixed an issue where images were being duplicated while sideloading (all credit to [@tamw-wnet](https://github.com/tamw-wnet) for the catch) [Issue #18](https://github.com/OpenPublicMedia/nprapi-wordpress/issues/18) = V1.9.3.1 = * Fixed bug that was preventing display of Simple Story elements in imported stories From c3a3add45e8ffab0db894e526946f1a6a14916a4 Mon Sep 17 00:00:00 2001 From: William Tam Date: Fri, 24 Jun 2022 18:41:03 +0000 Subject: [PATCH 02/15] use correct thumbnail logic to allow post featured image to be updated --- classes/NPRAPIWordpress.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/classes/NPRAPIWordpress.php b/classes/NPRAPIWordpress.php index 48b0f04..4eaf554 100644 --- a/classes/NPRAPIWordpress.php +++ b/classes/NPRAPIWordpress.php @@ -407,7 +407,11 @@ function update_posts_from_stories( $publish = TRUE, $qnum = false ) { //set the primary image if ( $image->type == 'primary' && $file_OK ) { - add_post_meta( $post_id, '_thumbnail_id', $image_upload_id, true ); + $current_thumbnail_id = get_post_thumbnail_id($post_id); + if (!empty($current_thumbnail_id) && $current_thumbnail_id != $image_upload_id) { + delete_post_thumbnail($post_id); + } + set_post_thumbnail( $post_id, $image_upload_id); //get any image meta data and attatch it to the image post if ( NPR_IMAGE_CREDIT_META_KEY === NPR_IMAGE_AGENCY_META_KEY ) { $image_credits = [ $image->producer->value, $image->provider->value ]; @@ -1225,4 +1229,4 @@ function get_body_with_layout( $story, $layout ) { $returnary['body'] = nprstory_esc_html( $body_with_layout ); return $returnary; } -} \ No newline at end of file +} From c7a521ff569b6bd065f84eac323c2fe2d98f270f Mon Sep 17 00:00:00 2001 From: Jared Counts Date: Fri, 24 Jun 2022 14:07:11 -0500 Subject: [PATCH 03/15] Version number bump --- README.md | 5 ++++- classes/NPRAPIWordpress.php | 10 +++++----- composer.json | 2 +- ds-npr-api.php | 2 +- readme.txt | 5 ++++- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 04c8a5c..c632aae 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A collection of tools for publishing from and to NPR's Story API. [Find this plu - Original developers: NPRDS, INN Labs - Requires at least: 3.8.14 - Tested up to: 6.0 -- Stable tag: 1.9.4 +- Stable tag: 1.9.4.1 - License: GPLv2 - License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -70,6 +70,9 @@ NPR Stories having got gotten ## Changelog +### V1.9.4.1 +* Fixed an issue where updating imported articles was not also updating the post thumbnail (all credit to [@tamw-wnet](https://github.com/tamw-wnet) for the catch) [Issue #19](https://github.com/OpenPublicMedia/nprapi-wordpress/issues/19) + ### V1.9.4 * Changed `nprstory_get_datetimezone()` to generate a new `DateTimeZone` off of the `timezone_string` WP option. The previous method tried to use `gmt_offset` in seconds, but `DateTimeZone` requires a string * Fixed an issue where inserted images in imported stories might have quotation marks in their alt tags diff --git a/classes/NPRAPIWordpress.php b/classes/NPRAPIWordpress.php index 4eaf554..f3e82c7 100644 --- a/classes/NPRAPIWordpress.php +++ b/classes/NPRAPIWordpress.php @@ -407,11 +407,11 @@ function update_posts_from_stories( $publish = TRUE, $qnum = false ) { //set the primary image if ( $image->type == 'primary' && $file_OK ) { - $current_thumbnail_id = get_post_thumbnail_id($post_id); - if (!empty($current_thumbnail_id) && $current_thumbnail_id != $image_upload_id) { - delete_post_thumbnail($post_id); - } - set_post_thumbnail( $post_id, $image_upload_id); + $current_thumbnail_id = get_post_thumbnail_id( $post_id ); + if ( !empty( $current_thumbnail_id ) && $current_thumbnail_id != $image_upload_id ) { + delete_post_thumbnail( $post_id ); + } + set_post_thumbnail( $post_id, $image_upload_id ); //get any image meta data and attatch it to the image post if ( NPR_IMAGE_CREDIT_META_KEY === NPR_IMAGE_AGENCY_META_KEY ) { $image_credits = [ $image->producer->value, $image->provider->value ]; diff --git a/composer.json b/composer.json index 29f3452..c593972 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "license" : "GPL-2.0+", "require": {}, "dist": { - "url": "https://github.com/OpenPublicMedia/nprapi-wordpress/archive/refs/tags/v1.9.4.zip", + "url": "https://github.com/OpenPublicMedia/nprapi-wordpress/archive/refs/tags/v1.9.4.1.zip", "type": "zip" }, "authors": [ diff --git a/ds-npr-api.php b/ds-npr-api.php index c7741cb..e3e11a7 100644 --- a/ds-npr-api.php +++ b/ds-npr-api.php @@ -2,7 +2,7 @@ /** * Plugin Name: NPR Story API * Description: A collection of tools for reusing content from NPR.org, now maintained and updated by NPR member station developers - * Version: 1.9.4 + * Version: 1.9.4.1 * Author: Open Public Media * License: GPLv2 */ diff --git a/readme.txt b/readme.txt index 76db604..33c09cb 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://www.npr.org/series/750002/support-public-radio Tags: npr, news, public radio, api Requires at least: 3.8.14 Tested up to: 6.0 -Stable tag: 1.9.4 +Stable tag: 1.9.4.1 License: GPLv2 License URI: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: nprapi @@ -70,6 +70,9 @@ NPR Stories having got gotten == Changelog == += V1.9.4.1 = +* Fixed an issue where updating imported articles was not also updating the post thumbnail (all credit to [@tamw-wnet](https://github.com/tamw-wnet) for the catch) [Issue #19](https://github.com/OpenPublicMedia/nprapi-wordpress/issues/19) + = V1.9.4 = * Changed `nprstory_get_datetimezone()` to generate a new `DateTimeZone` off of the `timezone_string` WP option. The previous method tried to use `gmt_offset` in seconds, but `DateTimeZone` requires a string * Fixed an issue where inserted images in imported stories might have quotation marks in their alt tags From 416161a6b63e1e3dd268e57bf52667dd637ae334 Mon Sep 17 00:00:00 2001 From: Jared Counts Date: Fri, 1 Jul 2022 14:50:45 -0500 Subject: [PATCH 04/15] Adding filters for pushing and deleting articles from the API --- classes/NPRAPIWordpress.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/classes/NPRAPIWordpress.php b/classes/NPRAPIWordpress.php index f3e82c7..8c7a706 100644 --- a/classes/NPRAPIWordpress.php +++ b/classes/NPRAPIWordpress.php @@ -632,10 +632,12 @@ function send_request ( $nprml, $post_ID ) { $error_text = ''; $org_id = get_option( 'ds_npr_api_org_id' ); if ( !empty( $org_id ) ) { - $url = add_query_arg( [ + $args = [ 'orgId' => $org_id, 'apiKey' => get_option( 'ds_npr_api_key' ) - ], get_option( 'ds_npr_api_push_url' ) . '/story' ); + ]; + $args = apply_filters( 'npr_pre_article_push', $args, $post_ID ); + $url = add_query_arg( $args, get_option( 'ds_npr_api_push_url' ) . '/story' ); nprstory_error_log( 'Sending nprml = ' . $nprml ); @@ -686,11 +688,13 @@ function send_request ( $nprml, $post_ID ) { * @param $api_id */ function send_delete( $api_id ) { - $url = add_query_arg( [ + $args = [ 'orgId' => get_option( 'ds_npr_api_org_id' ), 'apiKey' => get_option( 'ds_npr_api_key' ), 'id' => $api_id - ], get_option( 'ds_npr_api_push_url' ) . '/story' ); + ]; + $args = apply_filters( 'npr_pre_article_delete', $args ); + $url = add_query_arg( $args, get_option( 'ds_npr_api_push_url' ) . '/story' ); $result = wp_remote_request( $url, [ 'method' => 'DELETE' ] ); $body = wp_remote_retrieve_body( $result ); From 3b93a2b72842f4212f4e10e3a28537f02d4c70a5 Mon Sep 17 00:00:00 2001 From: pineros <61841991+pineros@users.noreply.github.com> Date: Wed, 12 Oct 2022 11:31:44 -0400 Subject: [PATCH 05/15] Managed by Terraform --- .github/workflows/wliw.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/wliw.yml diff --git a/.github/workflows/wliw.yml b/.github/workflows/wliw.yml new file mode 100644 index 0000000..a7f3f9a --- /dev/null +++ b/.github/workflows/wliw.yml @@ -0,0 +1,37 @@ +name: Trigger WLIW AWS CodePipeline + +on: + push: + branches: + - 'dev' + - 'preprod' + - 'main' + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Trigger WLIW DEV AWS CodePipeline + uses: zulhfreelancer/aws-codepipeline-action@v1.0.7 + if: github.ref == 'refs/heads/dev' + with: + aws-region: "us-east-1" + aws-access-key: ${{ secrets.DEV_AWS_CODEPIPELINE_ACCESS_KEY }} + aws-secret-key: ${{ secrets.DEV_AWS_CODEPIPELINE_SECRET_KEY }} + pipeline-name: "wliw" + - name: Trigger WLIW PREPROD AWS CodePipeline + uses: zulhfreelancer/aws-codepipeline-action@v1.0.7 + if: github.ref == 'refs/heads/preprod' + with: + aws-region: "us-east-1" + aws-access-key: ${{ secrets.PREPROD_AWS_CODEPIPELINE_ACCESS_KEY }} + aws-secret-key: ${{ secrets.PREPROD_AWS_CODEPIPELINE_SECRET_KEY }} + pipeline-name: "wliw" + - name: Trigger WLIW PROD AWS CodePipeline + uses: zulhfreelancer/aws-codepipeline-action@v1.0.7 + if: github.ref == 'refs/heads/main' + with: + aws-region: "us-east-1" + aws-access-key: ${{ secrets.PROD_AWS_CODEPIPELINE_ACCESS_KEY }} + aws-secret-key: ${{ secrets.PROD_AWS_CODEPIPELINE_SECRET_KEY }} + pipeline-name: "wliw" \ No newline at end of file From cde4029eec060a9e1872ebad55a501a27933164a Mon Sep 17 00:00:00 2001 From: pineros <61841991+pineros@users.noreply.github.com> Date: Tue, 25 Oct 2022 13:29:18 -0400 Subject: [PATCH 06/15] Managed by Terraform --- .github/workflows/wliw.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/wliw.yml diff --git a/.github/workflows/wliw.yml b/.github/workflows/wliw.yml new file mode 100644 index 0000000..a7f3f9a --- /dev/null +++ b/.github/workflows/wliw.yml @@ -0,0 +1,37 @@ +name: Trigger WLIW AWS CodePipeline + +on: + push: + branches: + - 'dev' + - 'preprod' + - 'main' + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Trigger WLIW DEV AWS CodePipeline + uses: zulhfreelancer/aws-codepipeline-action@v1.0.7 + if: github.ref == 'refs/heads/dev' + with: + aws-region: "us-east-1" + aws-access-key: ${{ secrets.DEV_AWS_CODEPIPELINE_ACCESS_KEY }} + aws-secret-key: ${{ secrets.DEV_AWS_CODEPIPELINE_SECRET_KEY }} + pipeline-name: "wliw" + - name: Trigger WLIW PREPROD AWS CodePipeline + uses: zulhfreelancer/aws-codepipeline-action@v1.0.7 + if: github.ref == 'refs/heads/preprod' + with: + aws-region: "us-east-1" + aws-access-key: ${{ secrets.PREPROD_AWS_CODEPIPELINE_ACCESS_KEY }} + aws-secret-key: ${{ secrets.PREPROD_AWS_CODEPIPELINE_SECRET_KEY }} + pipeline-name: "wliw" + - name: Trigger WLIW PROD AWS CodePipeline + uses: zulhfreelancer/aws-codepipeline-action@v1.0.7 + if: github.ref == 'refs/heads/main' + with: + aws-region: "us-east-1" + aws-access-key: ${{ secrets.PROD_AWS_CODEPIPELINE_ACCESS_KEY }} + aws-secret-key: ${{ secrets.PROD_AWS_CODEPIPELINE_SECRET_KEY }} + pipeline-name: "wliw" \ No newline at end of file From 3775046d05cbd31f469d76f2081ecae3e7317ebd Mon Sep 17 00:00:00 2001 From: William Tam Date: Fri, 18 Nov 2022 21:22:15 +0000 Subject: [PATCH 07/15] check dimensions of enlargement and use npr resizer if appropriate --- classes/NPRAPIWordpress.php | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/classes/NPRAPIWordpress.php b/classes/NPRAPIWordpress.php index 8c7a706..8c2c6ec 100644 --- a/classes/NPRAPIWordpress.php +++ b/classes/NPRAPIWordpress.php @@ -336,28 +336,34 @@ function update_posts_from_stories( $publish = TRUE, $qnum = false ) { // check the and then the crops, in this order "enlargement", "standard" if they don't exist, just get the image->src if ( !empty( $image->enlargement ) ) { $image_url = $image->enlargement->src; - } else { - if ( !empty( $image->crop ) && is_array( $image->crop ) ) { + } + if ( !empty( $image->crop ) && is_array( $image->crop ) ) { + foreach ( $image->crop as $crop ) { + if ( empty( $crop->type ) ) { + continue; + } + if ( 'enlargement' === $crop->type ) { + $image_url = $crop->src; + // sometimes enlargements are much larger than needed + if ( ( 1500 < $crop->height ) || ( 2000 < $crop->width ) ){ + // if there's no querystring already, add s=6 which media.npr.org resizes to a usable but large size + if ( strpos( $image_url, "?" ) === false ) { + $image_url .= "?s=6"; + } + } + } + } + if ( empty( $image_url ) ) { foreach ( $image->crop as $crop ) { if ( empty( $crop->type ) ) { continue; } - if ( 'enlargement' === $crop->type ) { + if ( 'standard' === $crop->type ) { $image_url = $crop->src; } } - if ( empty( $image_url ) ) { - foreach ( $image->crop as $crop ) { - if ( empty( $crop->type ) ) { - continue; - } - if ( 'standard' === $crop->type ) { - $image_url = $crop->src; - } - } - } } - } + } if ( empty( $image_url ) && !empty( $image->src ) ) { $image_url = $image->src; From 443ae669243ba4bbb6c4c9f87280df2b605b0041 Mon Sep 17 00:00:00 2001 From: pineros <61841991+pineros@users.noreply.github.com> Date: Mon, 12 Dec 2022 15:50:38 -0600 Subject: [PATCH 08/15] Managed by Terraform --- .github/workflows/njpbs.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/njpbs.yml diff --git a/.github/workflows/njpbs.yml b/.github/workflows/njpbs.yml new file mode 100644 index 0000000..cc95d0d --- /dev/null +++ b/.github/workflows/njpbs.yml @@ -0,0 +1,37 @@ +name: Trigger NJPBS AWS CodePipeline + +on: + push: + branches: + - 'dev' + - 'preprod' + - 'main' + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Trigger NJPBS DEV AWS CodePipeline + uses: zulhfreelancer/aws-codepipeline-action@v1.0.7 + if: github.ref == 'refs/heads/dev' + with: + aws-region: "us-east-1" + aws-access-key: ${{ secrets.DEV_AWS_CODEPIPELINE_ACCESS_KEY }} + aws-secret-key: ${{ secrets.DEV_AWS_CODEPIPELINE_SECRET_KEY }} + pipeline-name: "njpbs" + - name: Trigger NJPBS PREPROD AWS CodePipeline + uses: zulhfreelancer/aws-codepipeline-action@v1.0.7 + if: github.ref == 'refs/heads/preprod' + with: + aws-region: "us-east-1" + aws-access-key: ${{ secrets.PREPROD_AWS_CODEPIPELINE_ACCESS_KEY }} + aws-secret-key: ${{ secrets.PREPROD_AWS_CODEPIPELINE_SECRET_KEY }} + pipeline-name: "njpbs" + - name: Trigger NJPBS PROD AWS CodePipeline + uses: zulhfreelancer/aws-codepipeline-action@v1.0.7 + if: github.ref == 'refs/heads/main' + with: + aws-region: "us-east-1" + aws-access-key: ${{ secrets.PROD_AWS_CODEPIPELINE_ACCESS_KEY }} + aws-secret-key: ${{ secrets.PROD_AWS_CODEPIPELINE_SECRET_KEY }} + pipeline-name: "njpbs" \ No newline at end of file From 10e9e97148f6a68a62656f7114b55f413089fb97 Mon Sep 17 00:00:00 2001 From: pineros <61841991+pineros@users.noreply.github.com> Date: Tue, 13 Dec 2022 09:31:27 -0600 Subject: [PATCH 09/15] Managed by Terraform --- .github/workflows/njpbs.yml | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/njpbs.yml diff --git a/.github/workflows/njpbs.yml b/.github/workflows/njpbs.yml new file mode 100644 index 0000000..cc95d0d --- /dev/null +++ b/.github/workflows/njpbs.yml @@ -0,0 +1,37 @@ +name: Trigger NJPBS AWS CodePipeline + +on: + push: + branches: + - 'dev' + - 'preprod' + - 'main' + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Trigger NJPBS DEV AWS CodePipeline + uses: zulhfreelancer/aws-codepipeline-action@v1.0.7 + if: github.ref == 'refs/heads/dev' + with: + aws-region: "us-east-1" + aws-access-key: ${{ secrets.DEV_AWS_CODEPIPELINE_ACCESS_KEY }} + aws-secret-key: ${{ secrets.DEV_AWS_CODEPIPELINE_SECRET_KEY }} + pipeline-name: "njpbs" + - name: Trigger NJPBS PREPROD AWS CodePipeline + uses: zulhfreelancer/aws-codepipeline-action@v1.0.7 + if: github.ref == 'refs/heads/preprod' + with: + aws-region: "us-east-1" + aws-access-key: ${{ secrets.PREPROD_AWS_CODEPIPELINE_ACCESS_KEY }} + aws-secret-key: ${{ secrets.PREPROD_AWS_CODEPIPELINE_SECRET_KEY }} + pipeline-name: "njpbs" + - name: Trigger NJPBS PROD AWS CodePipeline + uses: zulhfreelancer/aws-codepipeline-action@v1.0.7 + if: github.ref == 'refs/heads/main' + with: + aws-region: "us-east-1" + aws-access-key: ${{ secrets.PROD_AWS_CODEPIPELINE_ACCESS_KEY }} + aws-secret-key: ${{ secrets.PROD_AWS_CODEPIPELINE_SECRET_KEY }} + pipeline-name: "njpbs" \ No newline at end of file From 2cfa6bc2d15778f3f6b5dbcb0c5a0b531737a36c Mon Sep 17 00:00:00 2001 From: pineros <61841991+pineros@users.noreply.github.com> Date: Thu, 2 Nov 2023 12:30:26 -0400 Subject: [PATCH 10/15] Managed by Terraform From 2c86d3be2708808a31a685ce0d7c9af037b22c55 Mon Sep 17 00:00:00 2001 From: pineros <61841991+pineros@users.noreply.github.com> Date: Thu, 2 Nov 2023 16:10:30 -0400 Subject: [PATCH 11/15] Managed by Terraform From 0d14ef36e9b0159dd789a967f0a4dac735f49fde Mon Sep 17 00:00:00 2001 From: pineros <61841991+pineros@users.noreply.github.com> Date: Thu, 9 Nov 2023 16:05:42 -0500 Subject: [PATCH 12/15] Managed by Terraform From d948fa9ec910706f5fce1eba4e80f75f57470636 Mon Sep 17 00:00:00 2001 From: pineros <61841991+pineros@users.noreply.github.com> Date: Thu, 9 Nov 2023 16:40:23 -0500 Subject: [PATCH 13/15] Managed by Terraform From 8ab8398153af7a8a2775a95953682773c8a11f3d Mon Sep 17 00:00:00 2001 From: William Tam Date: Tue, 5 Dec 2023 09:40:53 -0500 Subject: [PATCH 14/15] no_found_rows --- classes/NPRAPIWordpress.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/NPRAPIWordpress.php b/classes/NPRAPIWordpress.php index 8c2c6ec..6c60287 100644 --- a/classes/NPRAPIWordpress.php +++ b/classes/NPRAPIWordpress.php @@ -116,7 +116,8 @@ function update_posts_from_stories( $publish = TRUE, $qnum = false ) { 'meta_key' => NPR_STORY_ID_META_KEY, 'meta_value' => $story->id, 'post_type' => $pull_post_type, - 'post_status' => 'any' + 'post_status' => 'any', + 'no_found_rows' => true ]); // set the mod_date and pub_date to now so that for a new story we will fail the test below and do the update From 0228c9fcad4e47a3b80e1e28f9cfd4db86d3c607 Mon Sep 17 00:00:00 2001 From: Brian Santalone <61802815+santalone@users.noreply.github.com> Date: Tue, 5 Dec 2023 10:37:37 -0500 Subject: [PATCH 15/15] Update NPRAPIWordpress.php --- classes/NPRAPIWordpress.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/classes/NPRAPIWordpress.php b/classes/NPRAPIWordpress.php index 6c60287..cbae5b9 100644 --- a/classes/NPRAPIWordpress.php +++ b/classes/NPRAPIWordpress.php @@ -117,14 +117,15 @@ function update_posts_from_stories( $publish = TRUE, $qnum = false ) { 'meta_value' => $story->id, 'post_type' => $pull_post_type, 'post_status' => 'any', - 'no_found_rows' => true + 'no_found_rows' => true ]); // set the mod_date and pub_date to now so that for a new story we will fail the test below and do the update $post_mod_date = strtotime( date( 'Y-m-d H:i:s' ) ); $post_pub_date = $post_mod_date; $cats = []; - if ( $exists->found_posts ) { + // BS: no_found_rows doesnt return $exists->found_posts, so use $exists->posts. + if ( $exists->posts ) { $existing = $exists->post; $post_id = $existing->ID; $existing_status = $exists->posts[0]->post_status;