我有这段代码,我想修改它:
if ( ! empty( $_GET[ 'taxonomy' ] ) && $_GET[ 'taxonomy' ] == 'custom1' || 'custom2' && $pagenow == 'edit-tags.php' )
是的,这是一个Wordpress语句,但问题在于PHP||运算符。我希望$_GET["taxonomy"]等于custom1或custom2。
以下是正确的编码方式吗?
if ( ! empty( $_GET[ 'taxonomy' ] ) && $_GET[ 'taxonomy' ] == ('custom1' || 'custom2') && $pagenow == 'edit-tags.php' )
尝试使用此
if ( isset($_GET['taxonomy']) && ($_GET['taxonomy'] == 'custom1' || $_GET['taxonomy'] == 'custom2') && $pagenow == 'edit-tags.php')