I'm getting the following error "Notice: Undefined index:" on 'name' => $_GET['channel'].
When there's a parameter it works and allows the loop to proceed, but when there's no parameter set then I get the error above.
If I try isset it then removes the error but stops the wordpress loop from proceeding if a parameter is set.
What am I missing?
<?php
$args = array (
'post_type' => 'abc_channels',
'name' => $_GET['channel'],
'post_status' => 'publish',
'posts_per_page' => 1,
);
$loop = new WP_query( $args );
// If we have live channels
if (isset($_GET['channel'])) :
if($loop->have_posts()):
while($loop->have_posts()): $loop->the_post();
?>