Showing user ID on user main page from screen options

You need to use the filter ‘manage_’ . $screen->id . ‘_columns’ to add a column and manage_users_custom_column to display its value. add_filter( ‘manage_users_columns’, ‘column_register_wpse_101322’ ); add_filter( ‘manage_users_custom_column’, ‘column_display_wpse_101322’, 10, 3 ); function column_register_wpse_101322( $columns ) { $columns[‘uid’] = ‘ID’; return $columns; } function column_display_wpse_101322( $empty, $column_name, $user_id ) { if ( ‘uid’ != $column_name ) … Read more

Limit number of pages in pagination

Before I start, do not use get_posts for paginated queries. get_posts legally breaks pagination, and does not return the query object. If you need to paginate queries, use WP_Query As for your issue, I really don’t think limiting the total overall amount of posts to only 100 is possible when you involve pagination. The only … Read more

How do I create a drop down menu in a widget?

This is what I do: Static Options <select id=”<?php echo $this->get_field_id(‘posttype’); ?>” name=”<?php echo $this->get_field_name(‘posttype’); ?>” class=”widefat” style=”width:100%;”> <option <?php selected( $instance[‘posttype’], ‘Option 1’); ?> value=”Option 1″>Option 1</option> <option <?php selected( $instance[‘posttype’], ‘Option 2’); ?> value=”Option 2″>Option 2</option> <option <?php selected( $instance[‘posttype’], ‘Option 3’); ?> value=”Option 3″>Option 3</option> </select> Generate with options with PHP (example) … Read more

How do I redirect all 404 errors of a specific post type to another URL?

It looks like template_redirect is as far up the WordPress action chain you can go while still being able to detect that a 404 error is being thrown. This action will trigger before any template files would be loaded so it will happen before loading unnecessary resources. You can try adding this into your /wp-content/themes/yourtheme/functions.php … Read more

Filter the blog title displayed in the header

Remove that filter/function and apply your markup in the PHP template/page file. If you need help post where you output the title. CLASS Here is how I might set this up using a class: if ( ! class_exists( ‘ThemeCustomizations’ ) ) { class ThemeCustomizations { static $inBody = false; public static function set_in_body_true() { static::$inBody … Read more

Change destination author link

To only edit the link associated with authors, in the functions.php of your theme: add_filter( ‘author_link’, ‘new_author_link’, 10, 1 ); function new_author_link( $link ) { $link = ‘http://newlink.com/’; //set this however you wish return $link; //after you’ve set $link, return it to the filter } If you’re looking to do something like set each author’s … Read more

How to list the Hooks and order of execution in current loading page? [duplicate]

Paste this into your functions.php //LIST ALL HOOKS function dump_hook( $tag, $hook ) { ksort($hook); echo “<pre>>>>>>\t$tag<br>”; foreach( $hook as $priority => $functions ) { echo $priority; foreach( $functions as $function ) if( $function[‘function’] != ‘list_hook_details’ ) { echo “\t”; if( is_string( $function[‘function’] ) ) echo $function[‘function’]; elseif( is_string( $function[‘function’][0] ) ) echo $function[‘function’][0] . … Read more

How to remove html comment from source?

Here’s a quick way to remove all comments using output buffering and preg_replace. We hook in before WordPress starts outputting the HTML to start the buffer. Then we hook in after WordPress stops outputting the HTML to get the buffer and strip the HTML comment tags from the content. This code would ideally be in … Read more