Articles of admin

Add text to wordpress admin 'Add Post' edit

I’d like to add some descriptive text underneath the page title on both the list and edit post screens for the default post and also custom post types – e.g. “Below is a list of your recent blog posts.” What’s the best way to do this? I need to make add a list of instructions […]

Is it safe to post form data via Ajax to the settings api? Am I missing something?

In my WordPress Admin, I have my theme options set-up using the Settings API. I am trying to save the theme options form using Ajax so that the page does not refresh. The only thing i needed to add was this jQuery code : $(“#cgform”).submit(function() { var form_data = $(‘#cgform input’).serializeArray(); $.post( ‘options.php’, form_data ).error(function() […]

Display update notification messages like 'What's New'

I am about to push out a new update for my plugin. I’ve used a few functions only available to WordPress 3.8, which is fine because I want to support the latest version. How do I display a message to the user before they update the plugin with a list of What’s New, or just […]

Adding markup to column text in “Edit Pages” admin page

I was wondering if there is a way to hook into the column titles in the “All Posts” admin page to modify them. For instance, I would like to change “Post” to “<strong>Headline</strong>“. Are there any hooks that would let be do this without modifying the WordPress core code? I have found some information about […]

How to find out if an wp-admin action edited a file?

I want to create a small plugin to automatically purge the APC opcode cache after specific actions in the WordPress admin interface. This is necessary if e.g. apc.stat is set to 0, as a change to a file then doesn’t reset its cache value in the opcode cache and so calls will use the old, […]

Custom Loop in Page Admin Causing Other Fields to Fail

I created a custom loop in the page admin section to manage a custom post type called “widgets” for that page. $ps_widget_list = get_post_meta( $post_id, ‘ps_widget_list’, true ); //first get the list of current widgets $active_widget_array = explode( ‘, ‘, $ps_widget_list ); //then separate those widgets into an array of active widgets // this array […]

Restrict dashboard access for specific user roles to specific actions

I have a script that enables a logged in user (role Author) to delete their own posts using get_delete_post_link(). However, I also want to be able to restrict the author’s access to the dashboard. Any attempt to do so using a plugin (Theme my Login, for example) or a simple script like those linked below […]

Any way to inherit methods from both my plugin class and WP_List_Class?

So WP 3.1 introduces the fancy WP_List_Class() causing me to rewrite all my custom admin tables. Fair enough. But…in the good’ol days, i was able to call my plugin methods using $this->method() as i included the page file within the method that got hooked to via add_submenu_page(). That was nice and somewhat elegant – or […]

Replacing select2 in admin backend for all selects

I originally posted this question as a javascript question here, but think maybe it would be better asked here. I tried adding select2 to all wordpress admin screens. However, since many selects are created dynamically, I needed to find a way to recognize the dynamic selects. I got it working, but the dynamic selects do […]

How to set CORS header?

I have been accessing media images in a Ruby on Rails application via ajax from wordpress 4.2.4. I am getting following error while accessing the image via ajax. XMLHttpRequest cannot load http://img.mywordpresstips.com/plugins/test.jpeg. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://stage.mysite.com’ is therefore not allowed access. I tried WP-CORS plugin and set * […]