refactor(resource): drop aksrt_resource CPT residue, post+meta only
This commit is contained in:
@@ -41,16 +41,16 @@ if (!function_exists('aksrt_get_term_flow')) {
|
||||
|
||||
if (!function_exists('aksrt_is_resource_post')) {
|
||||
/**
|
||||
* 是否为资源(post + _aksrt_is_resource meta,或历史 aksrt_resource CPT)。
|
||||
* 是否为资源帖:普通 post + _aksrt_is_resource meta。
|
||||
*
|
||||
* @param int|WP_Post|null $post
|
||||
* @return bool
|
||||
*/
|
||||
function aksrt_is_resource_post($post = null): bool {
|
||||
$p = get_post($post);
|
||||
if (!($p instanceof WP_Post)) return false;
|
||||
if ($p->post_type === 'aksrt_resource') return true;
|
||||
if ($p->post_type !== 'post') return false;
|
||||
if (!($p instanceof WP_Post) || $p->post_type !== 'post') {
|
||||
return false;
|
||||
}
|
||||
return (bool) get_post_meta($p->ID, '_aksrt_is_resource', true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user