I ran into a serious problem on a client site because of the use of get_the_ID() on the edit page. The client was using buddypress-docs-in-group, which causes the Doc to appear in a different place in the WP page hierarchy (Groups rather than the single CPT). For some reason, get_the_ID() was properly filtered by our custom plugin prior to Docs 2.0, but not afterward, which caused some enormous headaches.
I haven't dug up the root cause for the 2.0 change, but we should be able to mitigate future damage by always using bp_docs_get_current_doc() and other filtered functions whenever referencing the current Doc. No direct uses of get_the_ID() (except in loops) or get_queried_object_id(). That way, the values can be reliably filtered.
I've made enough changes here to avoid the specific problems that my client experienced. I'm feeling too conservative to make more changes, so I'm going to call this done.
I ran into a serious problem on a client site because of the use of
get_the_ID()
on the edit page. The client was using buddypress-docs-in-group, which causes the Doc to appear in a different place in the WP page hierarchy (Groups rather than the single CPT). For some reason,get_the_ID()
was properly filtered by our custom plugin prior to Docs 2.0, but not afterward, which caused some enormous headaches.I haven't dug up the root cause for the 2.0 change, but we should be able to mitigate future damage by always using
bp_docs_get_current_doc()
and other filtered functions whenever referencing the current Doc. No direct uses ofget_the_ID()
(except in loops) orget_queried_object_id()
. That way, the values can be reliably filtered.