This should do what you want:
add_action('generate_rewrite_rules', 'wpse128082_add_rewrite_rule');
function wpse128082_add_rewrite_rule($wp_rewrite) {
$new_rules = array(
'^charts/(.*)' => 'index.php?pagename=charts&something='.$wp_rewrite->preg_index(1),
);
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
}
add_filter('query_vars', 'wpse128082_add_query_var');
function wpse128082_add_query_var($query_vars) {
$query_vars[] = 'something';
return $query_vars;
}
On your Charts page, you can access the new query var with get_query_var('something')
.
Related Posts:
- Meta_query compare operator explanation
- Exclude a category if post is only in that category using wp_Query
- Too slow when using both ‘tax_query’ and ‘meta_query’ both in WP_Query
- Use of caller_ get_ posts
- Tax_query terms ID’s using variable
- Custom query incorrectly returning everything [closed]
- Last post ordered by publish date using WP_Query on front page
- Query certain amount of posts from multiple dates
- Meta Query with date and time on the same Day before given time
- Order posts by tags count?
- Orderby = none not working [duplicate]
- Add inline HTML to posts published within last 24hrs
- Querying Multiple Custom Taxonomy Terms
- Single page theme
- How to extend tag and category “Related Posts” query to custom post_type if the first 2 terms have no posts
- WP_Query search for whole words
- WordPress pagination link always leads to home page
- Query posts with more than 20 comments
- WP_QUERY returns empty set when fired from a WP-CRON scheduled event
- Including only current user’s posts in search
- WP_Query, tax_query and term_meta: How to?
- How do I reset this wp_list_categories query?
- Refine search results using WP_Query
- query_posts: how to show all ‘meta_value’ containing a specific word?
- How to pass many ids in post__in?
- How to show subcategories using loop?
- Query with a meta value inside a given range
- Pagination of a WP_Query Loop in a child-page page template
- Add condition of user capability in WP_query
- add_filter() depending on search term
- Get all products which have both product category
- How do I run through a WordPress loop called from a filter function?
- Fastest way of counting posts of a custom post type in a specific taxonomy term?
- How to display user order by role
- WP_Query | Tax_Query Relation | Unable to use ‘OR’ as it then allows all products, help me finish my query?
- Why is wp_query causing an uncaught error to is_user_logged_in() not defined?
- Check if loop has any categories?
- WordPress query with items from more than one selfdefined taxonomy as `term` argument
- Get all fields inlcuding “ACF” (Advanced Custom Fields) columns in wp_query
- get_post_meta in WP_Query
- How to alter local query, not main query [duplicate]
- WP_query : Force last posts number over Reading Settings
- Order by most used tag
- WP_Query results stored in variables
- infinite loop in wp_query using simple query
- How to display the number of posts in a category using WP Query
- wp query for popular post with simple field
- Parent and child categories
- Set post number to single posts
- Is wp_reset_postdata always necessary?
- wp_query: implicit paging? I get less posts that I should
- Specific html within wordpress loop
- WP Query Meta Value – How To Identify Specific, Unique Values?
- Get user first name from custom endpoint
- Shortcode Not Working in Slider When Added To Post Title
- Displaying pages on an archive page
- Multiple pagename WP Query
- How does WP generate the default $query in WP_Query based on the URL?
- How I can repeat 2 HTML templates in a WordPress Query?
- Grabbing taxonomy terms and inserting them into an array
- custom page with post content using read more
- Meta query with compare by more than 2 fields
- Offset WP_Query by negative 1
- WP_Query orderby random do not repeat infinite scroll – one loop
- meta_query returning excluded result
- How to pass the current content of $wp_query to a new page?
- how to put thumbnail below category’s title?
- Woocommerce Shortcode which displays a table with product data
- JOIN filter doesn’t work in WP_Query in wp-ajax calls
- Passing a SQL query to the WP Query
- Why when I using infinity scroll the one post loads over and over?
- get_posts query is taking about 40 seconds to execute
- Customize the Sorting Dropdown in WooCommerce use another list or more page
- WP_Query by MAX post_id?
- Adding nofollow to all the post links in get_posts with pre_get_posts or WP_Query
- WP Query with meta queries
- Query post by Category and custom file (ACF)
- Regarding a custom loop and output HTML tags
- Taxonomy archive, categorised by other taxonomy, not hiding empty taxonomies
- Filtering ‘Featured’ posts from a batch of category IDs
- Migrating mysqli query to wp_query
- Second WP_Query loop shows data from main query
- My entry results are not consistently alphabetized
- Speed up WP_query with meta comparing dates
- Meta Query if Values Don’t Exist
- How to show all the associated posts with specific date of data metabox?
- How to order by datediff in WP loop?
- Custom query for tag and custom tag from 2 post type
- wpdb get_results() returns only 2 rows
- Search Functionality broken by the wp 4.2 update
- Issue attempting a wp_query_posts with tags
- Divide WP_Query posts by date & post type
- Custom query to show posts
- New WordPress WP Query using posts from certain categories
- Taxonomy related query not working
- Multiple Orderby is not working right
- WP query based on two meta queries
- WordPress website links redirect to homepage
- How do I have multiple metaqueries inside one wordpress query
- Can I use WP_Query to find a post with a particular menu_order?