Is there an action for when permalinks are rebuilt?

The action is update_option_permalink_structure. You get the old and the new value as parameters. add_action( ‘update_option_permalink_structure’ , ‘my_custom_function’, 10, 2 ); function my_custom_function( $oldvalue, $_newvalue ) { // do something } There are also the actions update_option_category_base and update_option_tag_base.

why does anchor name add a slash to url?

It is okay that the URL changes to http://mysite.com/contact/#rocket, but you should change the way you are defining your anchor on the target page. Instead of using this method <a name=”rocket”></a> <div> <h3>The Title</h3> <p>some text</p> </div> You should add an ID to the content you want to jump to like this: <div id=”rocket”> <h3>The … Read more

How to prevent the default home rewrite to a static page

The redirect is thanks to redirect_canonical() – we can simply swoop in with a filter and disable it for the front page: function wpse_184163_disable_canonical_front_page( $redirect ) { if ( is_page() && $front_page = get_option( ‘page_on_front’ ) ) { if ( is_page( $front_page ) ) $redirect = false; } return $redirect; } add_filter( ‘redirect_canonical’, ‘wpse_184163_disable_canonical_front_page’ ); … Read more

Why can’t I save permalink “360” for a page?

The problem comes with using only numbers as URLs. Here is a forum thread in WP that discuss this issue. I’ll cite Otto: WordPress 2.3 and up does not allow the post or page slugs to be all numeric. This is because that URL scheme will conflict with multi-page posts. There is no fix. Change … Read more

Using underscores instead of hyphens in the permalink

IMO hooking into sanitize_title is probably the best way to go here. Check out this plugin by Mark Jaquith which does something similar: http://txfx.net/files/wordpress/periods-in-titles.phps As for updating the old posts, I would just write a simple script that would generate sql to manually update everything. (code not tested) <?php function sanitize_title_with_underscores( $title ) { return … Read more

Update URL Snippet to Canonical Permalink URL

Why? I think the reason why a) domain.com/123 is not redirected back to b) domain.com/123/post-slug with the /%post_id%/%postname%/ permalinks settings, is that the matched rule is: [matched_rule] => ([0-9]+)(/[0-9]+)?/?$ You can get that information from the global $wp object. There are other useful informations in $wpavailable after the wp action: Example (post): domain.com/123/post-slug/ [query_vars] => … Read more

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