Multiple Permalinks for Same Post

The request parsing is handled in WP::parse_request(). After that, there’s a action hook parse_request which gives you the instance of the wp object. We assume that http://www.example.com/my-custom-post-type/this-is-a-cool-article is your permalink and http://www.example.com/mon-type-de-poste-personnalise/cest-un-article-sympa ends up in a 404. So the first thing to check in your callback should be, if the wp object is in a …

Read more

Translate third party plugin and save translation files in custom theme

First of all, I’d strongly recommend against storing translations for a plug-in in your theme. It has no reason to be there, and you’ll loose the translations when you change/update the theme. The correct place to store translations is wp-content/languages/plugins/. This code does that, and targets the domain ‘other_plugin’: function wpse159536_override_mofile_path( $mofile, $domain ){ if( …

Read more

Can’t we use strings defined as PHP constants if we want to translate them in a plugin?

I think this is happening because Constants cannot be redefined later. Once they are set, they are fixed. http://php.net/manual/en/language.constants.php I’m not exactly sure how WP language constructs work, but part of me thinks that they are defined, then changed later on the fly when plugins/themes use them. I don’t have a reference for this but …

Read more