Customizing WordPress background Implementation Management Simplification

Source: Internet
Author: User
Keywords Implementation WordPress customization backstage

Intermediary transaction SEO diagnosis Taobao guest Cloud host technology Hall

As a powerful publishing platform, WordPress has its own commented features, innovative GUI, article and page editing capabilities, and a variety of handy built-in tools, including the "Import" feature, user roles and permissions, and more.

But so many functions, how many are we commonly used? Although WordPress has been quite simple to use, the user is also quite friendly, but through the customization of WordPress management backstage, we can make WordPress simpler and easier to manage.

WordPress built-in hooks (including "Filter" and "action") for our custom WordPress backstage provides the perfect solution. By "checking in" rather than modifying WordPress's core programs, you can safely make changes without affecting the integrity of your installation files.

The code described below will be completed in the functions.php file.

Disable Console Widget

Login to WordPress Backstage, the first to see is the WordPress dashboard, a similar message center place, by the "WordPress Development Blog", "other WordPress News" and other widgets. For the average user, the information provided here is not necessarily what you will often need to see.

We can use Wp_dashboard_setup to remove these widgets. During execution, we use the unset () function to remove unwanted widgets. All we need to do is call Add_action () with Wp_dashboard_setup as the first argument, remove_dashboard_widgets as the second argument.

the following references:


function Remove_dashboard_widgets () {


global$wp_meta_boxes;


unset ($wp _meta_boxes[' dashboard ' [' normal '] [' core '] [' dashboard_plugins ']];


unset ($wp _meta_boxes[' dashboard '] [' normal '] [' core '] [' dashboard_recent_comments ']];


unset ($wp _meta_boxes[' dashboard '] [' side '] [' core '] [' dashboard_primary ']];


unset ($wp _meta_boxes[' dashboard ' [' normal '] [' core '] [' dashboard_incoming_links ']];


unset ($wp _meta_boxes[' dashboard ' [' normal '] [' core '] [' dashboard_right_now ']];


unset ($wp _meta_boxes[' dashboard '] [' side '] [' core '] [' dashboard_secondary ']];


}





add_action (' Wp_dashboard_setup ', ' remove_dashboard_widgets ');

The effect is as follows:

  

Disable Standard widget

WordPress defaults to 12 standard widgets. This includes "Calendar" (Wp_widget_calendar), "Search" (Wp_widget_search), "Recent comments" (wp_widget_recent_comments), and so on.

If your blog doesn't need a widget, you can disable it, such as a calendar widget. Or you may use a third-party search function, at which point you can disable WordPress's default search.

What we're going to use is a action called Widgets_init. We name the functions we need here as remove_some_wp_widgets. The WordPress function that needs to be used is unregister_widget (), with the name of the widget to be disabled as an argument.

the following references:


function Remove_some_wp_widgets () {


unregister_widget (' Wp_widget_calendar ');


unregister_widget (' Wp_widget_search ');


unregister_widget (' wp_widget_recent_comments ');


}





add_action (' Widgets_init ', Remove_some_wp_widgets ', 1);

The third parameter in the code is "1", which indicates the priority of the action used. The default value is 10, and the lower the value, the higher the priority. 1 indicates that it is one of the first functions to be invoked, regardless of the function's location in the functions.php.

Custom Drop-down Menu

WordPress Backstage There is a fast access to some features of the Pull-down menu, WordPress in this drop-down menu listed options include "Edit new article", "comment", "new page" and so on.

  

By calling a specific filter and canceling the link in the corresponding PHP array, we can quickly remove an option (or add a new option) to the Drop-down menu.

Here's an example of deleting "comments":

the following references:


function Custom_favorite_actions ($actions) {


unset ($actions [' edit-comments.php ']);


return $actions;


}





add_filter (' favorite_actions ', ' custom_favorite_actions ');

Modify background footer Information

WordPress Backstage Footer contains links to official WordPress website and official documents. We can also make a little change.

the following references:


function Modify_footer_admin () {


Echo ' Created by <a href= "http://example.com" >FILIP</A>


Echo ' powered by<a href= http://WordPress.org ' >wordpress</a>


}





add_filter (' Admin_footer_text ', ' modify_footer_admin ');

Hide Upgrade Tips

For security reasons, we do not recommend that you hide background upgrade reminders Because some version upgrades are for security vulnerabilities.

Of course if you want to delete or modify the upgrade prompts, you just add the following code to the functions.php:

the following references:


add_filter (' Pre_site_transient_update_core ', create_function (' $a ', ' return null; '));

After these changes, you will find a lot of refreshing background, and are not in the context of the WordPress core file changes Oh.

Source

WordPress, compile

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.