Filtering the Comment Form Allowed Tags

There’s a filter-hook that allows you to run some checking before comment is posted so you could use it too : add_filter(‘preprocess_comment’, ‘wpse_158147_check_new_comment’); function wpse_158147_check_new_comment($commentdata){ $commentdata[‘comment_content’] = preg_replace(“/<tag(.*?)>(.*)<\/tag>/”, “$2″, $commentdata[‘comment_content’]);// or str_replace return $commentdata; } Here “tag” would be stripped (to be replaced here with your specific tag).

Displaying a message when plug-in is deactivated

Actually, there’s a better way. All of my plugins require PHP5. Until recently, that wasn’t a requirement in WordPress, so a lot of people tried to install my plugins on systems missing vital PHP functions. I added some checks to my plugin to make sure it would work and, if not, display a message. But … Read more

Forbid contributors viewing drafts

Yes, but you might need a plugin like ‘User Role Editor‘. You can then edit the capabilities of roles, including contributors. So they can edit their own posts/drafts, but not the posts/drafts of others you should ensure that core capabilities: edit_posts is checked. edit_others_posts is unchecked

Merge posts plugin? [closed]

/** * Merge metadata from one post to another. * * @param int $from_ID Source post ID * @param int $to_ID Target post ID * @param bool $overwrite Whether to overwrite metadata if the key already exists * @return bool|array */ function wpse_20231_merge_postmeta( $from_ID, $to_ID, $overwrite = true ) { // get ALL metadata for … Read more

WordPress localization

if I have said string in comments.php in line 60, and move it to line 74, does it still get localized by the msgid? Yes it does. Localization does not depend on line numbers of strings.

use wp_get_theme() to get theme author name

Do not use just the header string, call display() instead and set the second parameter to FALSE to suppress markup. // FALSE for no markup $theme->display( ‘Author’, FALSE ); What you see in your var_dump() are private properties. If you print $theme->Author the magic __get() method is called and this calls display() without the second … Read more