Checking that the Rewrite API is available

You want WP_Rewrite::using_permalinks. <?php add_action(‘init’, ‘wpse142273_add_rules’); function wpse142273_add_rules() { global $wp_rewrite; if ($wp_rewrite->using_permalinks()) { // Plan A } else { // Plan B } } Here’s a larger example. <?php // inside a class somewhere public static function url($area, $additional=null) { global $wp_rewrite; if ($wp_rewrite->using_permalinks()) { $path = “/account/{$area}”; if ($additional) { $path .= “https://wordpress.stackexchange.com/” … Read more

Why is the generated POT file from WordPress.org not adding my plugin description to the POT file?

The makepot code being used on WordPress.org is a slightly older version that we have not updated yet, specifically with this fix: https://core.trac.wordpress.org/ticket/25665 Basically, it’s only looking in stripe.php for your main plugin lines, not searching for and then finding stripe-checkout.php. This was fixed in the developer tools 7 weeks ago: https://core.trac.wordpress.org/changeset/27399 But the change … Read more

How to change commenter links to /user/user_id?

You can use the get_comment_author_link hook, which is part of the get_comment_author_link() template tag, like your question already suggests. Then you only have to get the according user_id, which can be done via the $comment global, and construct the link you want accordingly. Exemplary usage like shown below: add_filter( ‘get_comment_author_link’, ‘wpse144835_custom_comment_author_link’ ); function wpse144835_custom_comment_author_link( $link … Read more

Plugin activation hook in an abstract class

The best way to get around this problem is not creating that abstract class. Never combine object creation with business logic in the same class. This is called a statically linked dependency and usually a flawed design, because you cannot change it on runtime (for tests or per hooks, for example). Avoid inheritance. Separation of … Read more

Plugin Customization Lost During Plugin Upgates

You have two options I can see after looking at the plugin, although there may be other ways to tackle this my time is limited so I’ll give you some insight on what you can do now, in the interim. First of all the plugin author provides you some additional filters: newsletter_profile_extra newsletter_subscription_extra newsletter_profile_save (see … Read more

Read text defined under __()

You should look at gettext filter hook which is applied to the translated text by the internationalization functions (__(), _e(), etc.). eg: add_filter( ‘gettext’, ‘my_sanitizer’, 20, 3 ); /** * my_sanitizer * @param string $translated_text the translation * @param string $text the origial text from __() * @param string $domain text domain * @return string … Read more