10up / distributor

Share content between your websites.
https://distributorplugin.com
GNU General Public License v2.0
640 stars 156 forks source link

Custom Post Types with no `editor` field or with no content are not sync'ed #679

Closed ggutenberg closed 3 years ago

ggutenberg commented 3 years ago

Describe the bug When a CPT does not include the editor field, or the author has left it empty and show_in_rest is false, the post does not stay in sync. Note that this was tested within a multisite.

Steps to Reproduce

  1. Create a CPT without supports => ['editor'].
  2. Create a post in the new CPT.
  3. Pull that post to the target site.
  4. Make a change to the original post.
  5. Note that it does not sync the changes to its subscriber.

Expected behavior The subscribed post is updated.

Environment information

wp-core

version: 5.5.3 site_language: en_US user_language: en_US timezone: America/Los_Angeles permalink: /%postname%/ https_status: false multisite: true user_registration: false blog_public: 1 default_comment_status: open environment_type: local user_count: 53 site_count: 2 network_count: 1 dotorg_communication: true

wp-active-theme

name: Wide Open School (wide-open-school) version: 1.0 author: Garth Gutenberg author_website: http://grinninggecko.com parent_theme: UnderStrap (understrap) theme_features: core-block-patterns, automatic-feed-links, title-tag, menus, html5, post-thumbnails, customize-selective-refresh-widgets, post-formats, custom-background, custom-logo, responsive-embeds, infinite-scroll, jetpack-responsive-videos, jetpack-social-menu, woocommerce, wc-product-gallery-lightbox, wc-product-gallery-zoom, wc-product-gallery-slider, widgets, editor-style theme_path: /Users/garth/dev/wp/wos-multi/app/public/wp-content/themes/wide-open-school auto_update: Disabled

wp-parent-theme

name: UnderStrap (understrap) version: 0.9.4 author: Holger Koenemann author_website: https://www.holgerkoenemann.de theme_path: /Users/garth/dev/wp/wos-multi/app/public/wp-content/themes/understrap auto_update: Disabled

wp-themes-inactive (3)

Twenty Nineteen: version: 1.7, author: the WordPress team (latest version: 1.8),Auto-updates disabled Twenty Seventeen: version: 2.4, author: the WordPress team (latest version: 2.5),Auto-updates disabled Twenty Twenty: version: 1.5, author: the WordPress team (latest version: 1.6),Auto-updates disabled

wp-mu-plugins (1)

WP Migrate DB Pro Compatibility: version: 1.2, author: Delicious Brains

wp-plugins-active (15)

Bulk remove posts from category: version: 3.1.1, author: MasterNs, Auto-updates disabled Distributor: version: 1.6.2, author: 10up Inc., Auto-updates disabled Don’t use ImageMagick: version: 1.0, author: WP Media, Auto-updates disabled Safe SVG: version: 1.9.9, author: Daryll Doyle, Auto-updates disabled SearchWP: version: 4.0.31, author: SearchWP (latest version: 4.0.34), Auto-updates disabled WP Crontrol: version: 1.8.5, author: John Blackbourn & crontributors, Auto-updates disabled WP Migrate DB Pro: version: 1.9.13, author: Delicious Brains, Auto-updates disabled WP Migrate DB Pro CLI: version: 1.3.5, author: Delicious Brains, Auto-updates disabled WP Migrate DB Pro Media Files: version: 1.4.15, author: Delicious Brains, Auto-updates disabled WP Migrate DB Pro Multisite Tools: version: 1.2.6, author: Delicious Brains, Auto-updates disabled WP Migrate DB Pro Theme & Plugin Files: version: 1.0.5, author: Delicious Brains, Auto-updates disabled WPML Media: version: 2.6.1, author: OnTheGoSystems, Auto-updates disabled WPML Multilingual CMS: version: 4.4.5, author: OnTheGoSystems, Auto-updates disabled WPML String Translation: version: 3.1.5, author: OnTheGoSystems, Auto-updates disabled WPML Translation Management: version: 2.10.3, author: OnTheGoSystems, Auto-updates disabled

wp-plugins-inactive (4)

Debug - WP Redirect: version: 1.0.0, author: Philipp Stracker, Auto-updates disabled Query Monitor: version: 3.6.5, author: John Blackbourn, Auto-updates disabled WordPress Admin Style: version: 1.5.6, author: Frank Bültge, Auto-updates disabled Yoast Duplicate Post: version: 3.2.6, author: Enrico Battocchi & Team Yoast, Auto-updates disabled

wp-media

image_editor: WP_Image_Editor_GD imagick_module_version: 1691 imagemagick_version: ImageMagick 6.9.11-35 Q16 x86_64 2020-11-13 https://imagemagick.org file_uploads: File uploads is turned off post_max_size: 1000M upload_max_filesize: 300M max_effective_size: 300 MB max_file_uploads: 20 gd_version: bundled (2.1.0 compatible) ghostscript_version: 9.53.3

wp-server

server_architecture: Darwin 19.6.0 x86_64 httpd_software: nginx/1.16.0 php_version: 7.4.1 64bit php_sapi: fpm-fcgi max_input_variables: 4000 time_limit: 1200 memory_limit: 256M max_input_time: 600 upload_max_filesize: 300M php_post_max_size: 1000M curl_version: 7.54.0 LibreSSL/2.6.5 suhosin: false imagick_availability: true pretty_permalinks: true

wp-database

extension: mysqli server_version: 8.0.16 client_version: mysqlnd 7.4.1

wp-constants

WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: /Users/garth/dev/wp/wos-multi/app/public/wp-content WP_PLUGIN_DIR: /Users/garth/dev/wp/wos-multi/app/public/wp-content/plugins WP_MAX_MEMORY_LIMIT: 256M WP_DEBUG: false WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: false SCRIPT_DEBUG: false WP_CACHE: false CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_LOCAL_DEV: undefined DB_CHARSET: utf8 DB_COLLATE: undefined

wp-filesystem

wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable mu-plugins: writable

distributor

0: 1.6.2 1: Override Author Byline: No Media Handling: Featured image and attached images 2: WOS NYC:

Additional context The issue is with \Distributor\Utils\is_using_gutenberg(). When editor is disabled, or editor is enabled but show_in_rest is disabled and the post_content is empty, this function wrongly assumes that the post is using Gutenberg, and short circuits the \Distributor\Subscriptions\send_notifications() function.

dkotter commented 3 years ago

@ggutenberg Apologies for missing this one but it sounds very similar (if not the same) as the issues outlined in #659. I have a PR up to fix that (#710) and I think that might fix your issue. If you have time to test that PR out and let us know if that helps resolve things, that would be super helpful. Thanks!