gatsbyjs / wp-gatsby

WordPress plugin for gatsby-source-wordpress
Other
167 stars 41 forks source link

ACF Options Page Monitoring #206

Closed henrikwirth closed 2 years ago

henrikwirth commented 2 years ago

Possible related issues: #114, #174, #183, #181

This PR approaches the problem of ACF Option pages not triggering content updates in Gatsby if the options are "saved/updated".

As per suggestion of @TylerBarnes, trigger_non_node_root_field_update is used to update the option fields. By default this implementation would apply monitoring for all ACF registered option pages, but makes sure that it is only applied on those and not on normal post types to prevent triggering multiple content updates.

With the filter in place one can whitelist specific pages for monitoring or turn of monitoring by passing an empty array (or false).

add_filter('gatsby_action_monitor_tracked_acf_options_pages', function () {
    return ['my-custom-option-page'];
});
TylerBarnes commented 2 years ago

@henrikwirth thanks for this PR! I meant to get to this before the holidays but haven't had time quite yet. I'm going to wait til Jan 3rd to merge this and make a new release because I want to be around if anything goes wrong :) I set a reminder for myself 👍

blakej115 commented 2 years ago

@TylerBarnes Can this get merged in? This is functionality that I must have, and would prefer to not have to pull from the forked repo if I don't have to. Thanks!

TylerBarnes commented 2 years ago

Published in v2.3.0

TylerBarnes commented 2 years ago

Thanks @henrikwirth !! 🎉