How do I add a custom button to my “edit” list? ( edit.php?post_type= ) beside “Add New”

I found a way to get it done but I am not very happy with this procedure. Please add your answer if you find better way. Mean while, this might be of help. add_action(‘admin_head-edit.php’,’addCustomImportButton’)); I only need this on edit page, so I am using admin_head-edit.php action, but you can use admin_head or some other … Read more

WP_Query pagination not working in admin area

Milo noted that there is no $wp_query object in wp-admin page, so we can get $paged via: $paged = ( $_GET[‘paged’] ) ? $_GET[‘paged’] : 1; Now that we have $paged, we can code our own pagination. I will demonstrate how in its very simplest form. First let’s get maximum pagination pages: $max_pages = $the_query->max_num_pages; … Read more

Block access to wp-admin

Placing the htaccess file in the wp-admin directory did not work for me so I went a different route and it seems to be working very well. Below is what I have in my main htaccess file: <files wp-login.php> # set up rule order order deny,allow # default deny deny from all allow from x.x.x.x … Read more

How Restrict access to admin dashboard by specific static ip?

By the time admin_init rolls around you should know if you’re doing AJAX or not. If you’re not, then check the IP. Keep in mind that anyone can fake that number. add_action(‘admin_init’, function() { if(defined(‘DOING_AJAX’) && DOING_AJAX) { return; // ignore ajax }; $ip = $_SERVER[ ‘REMOTE_ADDR’ ]; if($ip !== ‘10.0.0.0’) { wp_die(__(‘You are not … Read more

Creating a Post form outside of the Admin

Ok I have cracked it, by spoofing the $_SERVER variable and pre-defing some constants, I was able to prevent WordPress from redirecting after the inclusion of wp-load.php. define(‘WP_USE_THEMES’, false); define( ‘DOMAIN_CURRENT_SITE’, $siteRow[‘domain’] ); define( ‘PATH_CURRENT_SITE’, “https://wordpress.stackexchange.com/” ); define( ‘SITE_ID_CURRENT_SITE’, 1 ); define( ‘BLOG_ID_CURRENT_SITE’, $siteRow[‘wp_blog_id’] ); $_SERVER = array( “HTTP_HOST” => $siteRow[‘domain’], “SERVER_NAME” => $siteRow[‘domain’], “REQUEST_URI” … Read more

Add “Page Revised” column to Admin

Would need some prettifying, but basic code is following: add_filter(‘manage_pages_columns’, ‘add_revised_column’); add_action(‘manage_pages_custom_column’, ‘echo_revised_column’, 10, 2); function add_revised_column($columns) { $columns[‘revised’] = ‘Revised’; return $columns; } function echo_revised_column($column, $id) { if (‘revised’ == $column) echo get_post_field(‘post_modified’, $id); }

submit for review issue

Weird.. Have you checked the database on your own? Are you in the administrator group? Get your user id from the {tableprefix}_users table and search for the coresponding meta key {tableprefix}_user_level for your user id inside the {tableprefix}_usermeta table. The value should be set to 10. Do you have migrated the database from another wordpress … Read more

Creating WordPress Admin Themes

You’ll want to add your own stylesheet, e.g.: add_action(‘admin_head’, ‘custom_admin_style’); function custom_admin_style() { wp_register_style( ‘adminStylesheet’, plugins_url(‘adminstylesheet.css’, __FILE__) ); wp_enqueue_style(‘adminStylesheet’); } You can then style the admin as you like. For UI changes beyond styling its not possible to answer within the scope of this question as there are too many things possible to say in … Read more