Skip to content

Instantly share code, notes, and snippets.

@ShinichiNishikawa
Created November 24, 2012 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ShinichiNishikawa/4139916 to your computer and use it in GitHub Desktop.
Save ShinichiNishikawa/4139916 to your computer and use it in GitHub Desktop.
こっちでよかった。カテゴリ/タクソノミをGETで受け取った時のバリデーション。Validate GET values against cattegories / taxonomies the site has.
<?php
// category の場合
$what = get_term_by( 'name', $_GET['what'], 'category', 'ARRAY_A' );
// district というタクソノミの場合
$where = get_term_by( 'name', $_GET['where'], 'district', 'ARRAY_A' );
// https://gist.github.com/4139337 これが長い方
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment