記事の存在を確認する方法
-
記事の存在と投稿タイプを確認したいとき、➀と➁だったら➁だけで十分ですよね?
$post_id = esc_html( $_POST['post_id'] ); // ➀ if( ! is_numeric($post_id) || get_post_status( $post_id ) != 'publish' ){ $errors[] = 'post_id'; } else{ if( get_post_type($post_id) != 'custom1' ){ $errors[] = 'post_id'; } } // ➁ if( get_post_type($post_id) != 'custom1' ){ $errors[] = 'post_id'; }
2件の返信を表示中 - 1 - 2件目 (全2件中)
2件の返信を表示中 - 1 - 2件目 (全2件中)
- トピック「記事の存在を確認する方法」には新たに返信することはできません。