did you call global $wp_rewrite;
?
There are also plugins like the rewrite rules inspector. http://wordpress.org/plugins/rewrite-rules-inspector/
Also, the init hook would probably be best.
Yes, I called it. This is the code:
add_action('admin_menu', 'gp_call_add_rewrite_page');
function gp_call_add_rewrite_page() {
add_menu_page('Rewrite Page', 'Rewrite Page', 'manage_options', __FILE__, 'gp_add_rewrite_page', 'dashicons-edit');
}
function gp_add_rewrite_page() {
?>
<div class="wrap">
<h2>Rewrite Page</h2>
<?php
global $wp_rewrite;
var_dump($wp_rewrite);
?>
</div>
<?php
}
I set permalinks to /%postname%.html in Settings > Permalinks
I just tested, code works for me. Flush your rules perhaps.
I tried first time on 3.9-beta3 version so I tried also on 3.8.1 version but I can’t see any rules also flushing rules.
I found a solution, I don’t know if it is the best solution but it works.
I read directly from database using this line of code:
$rewrite_rules = get_option( 'rewrite_rules' );
and then I loop the array.