Closed rebeccahum closed 9 months ago
term_exists()
was handled in #812.
get_page_by_title()
has some interesting changes.
In https://core.trac.wordpress.org/ticket/36905 it was switched to use WP_Query
internally, and thus now included caching for WP 6.1.
However, as of https://core.trac.wordpress.org/ticket/57041 and WP 6.2, this change was reverted, and the function became deprecated in favour of WP_Query.
This function deprecation is included in WPCS.
So now, the question becomes - should we:
wpcom_vip_get_page_by_title()
as the recommended solutionget_page_by_title()
to recommend WP_Query (some what duplicating WPCS)get_page_by_path()
did have a reliance on WP_Query
, but that was reverted and as this time https://core.trac.wordpress.org/ticket/56689 is still open.
As the three functions have been addressed one way or another, this can be closed.
What code should not be reported as a violation?
Since the introduction of WP 6.0+, some functions (namely wpcom_vip_get_page_by_path(), wpcom_vip_term_exists() and wpcom_vip_get_page_by_title()) we previously suggested using the VIP-equivalent are now cached: https://docs.wpvip.com/technical-references/caching/uncached-functions/#h-previously-uncached-wordpress-core-functions.
We should deprecate suggesting the below since it's no longer accurate:
https://github.com/Automattic/VIP-Coding-Standards/blob/fbcc951c40378d188b0b054a76d626c792b0d537/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php#L286-L291 https://github.com/Automattic/VIP-Coding-Standards/blob/fbcc951c40378d188b0b054a76d626c792b0d537/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php#L83-L88 https://github.com/Automattic/VIP-Coding-Standards/blob/fbcc951c40378d188b0b054a76d626c792b0d537/WordPressVIPMinimum/Sniffs/Functions/RestrictedFunctionsSniff.php#L105-L111