rename local variable $cat to not mess up with WP global
This commit is contained in:
@ -27,12 +27,12 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||||||
<td>
|
<td>
|
||||||
<select id="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'category' ) ); ?>">
|
<select id="<?php echo esc_attr( $this->get_field_id( 'category' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'category' ) ); ?>">
|
||||||
<?php
|
<?php
|
||||||
foreach ( $categories as $cat ) {
|
foreach ( $categories as $c ) {
|
||||||
echo '<option value="' . esc_attr( $cat->slug ) . '"';
|
echo '<option value="' . esc_attr( $c->slug ) . '"';
|
||||||
if ( $category === $cat->slug ) {
|
if ( $category === $c->slug ) {
|
||||||
echo ' selected="selected"';
|
echo ' selected="selected"';
|
||||||
}
|
}
|
||||||
echo '>' . esc_html( $cat->name ) . '</option>';
|
echo '>' . esc_html( $c->name ) . '</option>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</select>
|
</select>
|
||||||
|
Reference in New Issue
Block a user