URL Rewrite + Page + Custom Post Type = Unusual Redirect

You should try setting ‘slug’ ( in the ‘rewrite’ parameter/option) to ‘our-firm/shareholders’, just like the structure you have set in the add_rewrite_rule() function. The first parameter of add_rewrite_rule() and the ‘rewrite’ setting of the custom post type must be equal in order to get the rewritting actually working. So, in case you choose coding the … Read more

Disable wordpress pagination URL rewrite for specific page

The redirect_canonical filter is responsible for this, which you can selectively disable depending on the requested page. This is untested, but should work: function wpa66273_disable_canonical_redirect( $query ) { if( ‘design-jobs’ == $query->query_vars[‘pagename’] ) remove_filter( ‘template_redirect’, ‘redirect_canonical’ ); } add_action( ‘parse_query’, ‘wpa66273_disable_canonical_redirect’ );

add_rewrite_rule, plugin activation and plugin deactivation

The problem with calling flush_rewrite_rules() is that the rules instantly get regenerated, while your plugin’s hooks are still active. What I usually do, because it’s the simplest route to success, is delete the rewrite_rules option on activation/deactivation. The rules will then get regenerated on the next pageload instead of the current one: register_deactivation_hook( __FILE__, ‘my_plugin_deactivation’); … Read more

Flush_rewrite_rules not working when settings updated

Does this work for you? Seems to work when I try it. function qd_settings_api_init() { add_settings_section( ‘qd_theme_setting_section’, ‘Theme Reading Settings’, ‘qd_theme_setting_section_callback_function’, ‘reading’ ); add_settings_field( ‘qd_news_page’, ‘News Page’, ‘qd_news_page_dropdown_cbf’, ‘reading’, ‘qd_theme_setting_section’ ); if (delete_transient(‘qd_flush_rules’)) flush_rewrite_rules(); // * Added register_setting( ‘reading’, ‘qd_news_page’, ‘qd_sanitize’ ); // * Changed } /* Added this function. */ function qd_sanitize($input) { set_transient(‘qd_flush_rules’); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)