- fixed PHP notices in some cases when WP query is not canonical;

This commit is contained in:
Mykyta Synelnikov
2023-07-30 22:59:49 +03:00
parent c9789b8462
commit ba2cc1cd94
+5 -1
View File
@@ -1843,12 +1843,16 @@ if ( ! class_exists( 'um\core\Access' ) ) {
* @param \WP_Post|int $post Post ID or object
* @return bool|array
*/
function get_post_privacy_settings( $post ) {
public function get_post_privacy_settings( $post ) {
// break for incorrect post
if ( empty( $post ) ) {
return false;
}
if ( ! is_numeric( $post ) && ! is_a( $post, \WP_Post::class ) ) {
return false;
}
static $cache = array();
$cache_key = is_numeric( $post ) ? $post : $post->ID;