Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Plugin Name: Fix dashboard_incoming_links_feed
- Plugin URI: http://core.trac.wordpress.org/ticket/20379
- Description: Fixes an issue updating the home URL's in Dashboard/Settings/General, in WP 3.3.1 and other versions. Note changes do not take effect until you return to Dashboard. To verify, look at the the db table 'wp_options' row with option_name='dashboard_widget_options'.
- Version: 1.0
- Author: kitchin
- License: FreeBSD
- */
- if ( ! function_exists('fix_dashboard_incoming_links_feed') ) {
- // This filter is called when the adminr changes 'home' in the Dashboard, and on initial WP setup.
- add_filter( 'dashboard_incoming_links_feed', 'fix_dashboard_incoming_links_feed' );
- function fix_dashboard_incoming_links_feed( $url ) {
- // Copy code from wp-admin/includes/dashboard.php :
- $widget_options = get_option( 'dashboard_widget_options' );
- if ( !$widget_options || !is_array($widget_options) )
- $widget_options = array();
- $num_items = isset($widget_options['dashboard_incoming_links']['items']) ? $widget_options['dashboard_incoming_links']['items'] : 10;
- // New code :
- // This value is hard-coded in wp-admin/includes/dashboard.php :
- $url_prefix = 'http://blogsearch.google.com/blogsearch_feeds?scoring=d&ie=utf-8&num=' . $num_items . '&output=rss&partner=wordpress&q=link:';
- // This is the default new url, as WP uses on initial setup :
- $url = $url_prefix . trailingslashit( get_option('home') );
- // Heuristic to override the default url if it has been modded in the db.
- // Maybe not a good idea, but here to maintain current WP behavior in that case.
- // Not tested.
- if ( isset( $widget_options['dashboard_incoming_links']['url'] ) ) {
- if (0 !== strpos($widget_options['dashboard_incoming_links']['url'], $url_prefix)) {
- $url = $widget_options['dashboard_incoming_links']['url'];
- }
- }
- // Note changes do not take effect until you return to Dashboard.
- // To verify, look at the the db table 'wp_options' row with option_name='dashboard_widget_options'.
- return $url;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement