I found many people having this problem in WP. The problem was caused by the “global” parameter. Obviously, WP has something important internal reserved for that parameter.
Global variable is a variable that is accessible in every scope, in PHP it works ONLY for the same page and the file that are included after. However, some predefined variables, known as superglobals are always accessible in whole site. Both of global and superglobal variable can be redefined or overwrite it’s value.
When developing a WordPress Plugin and or Theme, sometimes you use the PHP global variable. That’s okay, but it’s HIGHLY RECOMMENDED that you not use variable name that are already defined by WordPress. Why? Because it may break your other code that may intended to use WordPress variable.
Here is the lists of WordPress Reserved Variable, the left side is variable name, and the right side is the type
$_template_file = string $require_once = boolean $posts = array $post = object $wp_did_header = boolean $wp_did_template_redirect = NULL $wp_query = object $wp_rewrite = object $wpdb = object $wp_version = string $wp = object $id = integer $comment = NULL $user_ID = integer $cat = string $paged = integer $error = string $m = integer $p = integer $post_parent = string $subpost = string $subpost_id = string $attachment = string $attachment_id = integer $name = string $static = string $pagename = string $page_id = integer $second = string $minute = string $hour = string $day = integer $monthnum = integer $year = integer $w = integer $category_name = string $tag = string $tag_id = string $author_name = string $feed = string $tb = string $comments_popup = string $meta_key = string $meta_value = string $preview = string $s = string $sentence = string $fields = string $category__in = array $category__not_in = array $category__and = array $post__in = array $post__not_in = array $tag__in = array $tag__not_in = array $tag__and = array $tag_slug__in = array $tag_slug__and = array $ignore_sticky_posts = boolean $suppress_filters = boolean $cache_results = boolean $update_post_term_cache = boolean $update_post_meta_cache = boolean $post_type = string $posts_per_page = integer $nopaging = boolean $comments_per_page = string $no_found_rows = boolean $order = string