turn off new user registration emails

Generic Pluggable Approach for WordPress < 4.6 (See @birgire’s Answer for > 4.6) Pluggable functions are one of the more depressing relics of WordPress’s past and come with a slew of intricacies. That directly modifying the core file (which is entirely inadvisable, as @Jarmerson mentioned in the comments) did not work makes me suspect that … Read more

WordPress admin screen very slow / timing out when editing or adding a new page/custom post

This may not help any, but it can’t hurt to try it… Log into your server admin area, invoke the client interface for your database administration (e.g. phpMyAdmin), delete all the posts where their ‘type’ is marked as a revision, then compact the table. If you have thousands of pages, you might also have millions … Read more

Help! Turn php link data into url OR hide edit link in post admin OR hide drafts for all users except admin?

As far as I understood this right, you want to disable the possibility to reach any other side aside from the dashboard. Well, then here’s a short plugin for you: <?php ! defined( ‘ABSPATH’ ) AND exit; /* Plugin Name: (#45989) »kaiser« Allow Dashboard only access */ function wpse45989_access_dashboard_only() { if ( ! isset( get_current_screen()->id … Read more

Admin plugin, how can I output a different content-type?

I’ve done this two ways: 1) – a csv export function – detect that special content type handling is required BEFORE wp outputs anything. add_action (‘plugins_loaded’, ‘amr_meta_handle_csv’); function amr_meta_handle_csv ($csv, $suffix=’csv’) { // chcek if there is a csv request on this page BEFORE we do anything else ? if (( isset ($_POST[‘csv’]) )) { … Read more

Ordering posts by custom taxonomy in admin area

Here is what I do to sort my custom post type by custom taxonomy in the admin. I have a custom post type called plugin_filter and a custom taxonomy assigned to it called filter_group. I add the following filter to my plugin to make the field sortable. add_filter(“manage_edit-plugin_filter_sortable_columns”, ‘plugin_filter_sort’); function plugin_filter_sort($columns) { $custom = array( … Read more

Showing WP_Error message with admin_notice action hook

You can use function add_settings_error. More details can be found in the WordPress documentation. I have edited your previous answer to include that: function wpse_189722_limit_tag_words( $term, $taxonomy ) { if ($taxonomy === ‘post_tag’) { if ( count( preg_split( ‘/\s+/’, trim( $term ) ) ) > 2 ) { add_settings_error(‘term_too_many_words’, ‘term_too_many_words’, ‘Maximum of 2 words allowed, … Read more

What’s the easiest way to close comments on media/attachments?

This ought to do it: function wpse15750_comment_check( $id ){ if( get_post_type( $id ) == ‘attachment’ ) exit; } add_action( ‘pre_comment_on_post’, ‘wpse15750_comment_check’ ); EDIT Ignore the above. That will stop new comments, but to do what you want, this is much better: function wpse15750_comments_closed( $open, $id ){ if( get_post_type( $id ) == ‘attachment’ ) return false; … Read more