Call to a member function add_rule() on a non-object
You’re calling it too early. Call it on the init hook or later, e.g.: add_action( ‘init’, ‘add_alexes_rules’ ); function add_alexes_rules() { add_rewrite_rule(‘^(product)/([^/]*)/?’, ‘product?name=$matches[1]’,’top’); }