Skip to content

Instantly share code, notes, and snippets.

@bhubbard
Last active December 16, 2015 16:38
Show Gist options
  • Save bhubbard/5464134 to your computer and use it in GitHub Desktop.
Save bhubbard/5464134 to your computer and use it in GitHub Desktop.
function idxbroker_template_cleanup {
// Include for Active Plugin Check
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
// Remove Wordpress SEO Features for IDX Wrapper
if (is_plugin_active('wordpress-seo/wp-seo.php')) {
add_filter( 'wpseo_next_rel_link', '__return_false' ); // Disable Rel Next Link
add_filter( 'wpseo_canonical', '__return_false' ); // Disable Canonical Link
};
// Disable Wordpress Admin Bar for IDX Wrapper
add_filter( 'show_admin_bar', '__return_false' ); // Disable Bar
wp_dequeue_style( 'admin-bar' ); // Disable CSS
wp_dequeue_script( 'admin-bar' ); // Disable JS
// Disable Wordpress Features for IDX Wrapper
remove_action( 'wp_head', 'rel_canonical' ); // Hide Canonical Link
remove_action( 'wp_head', 'noindex', 1 ); // Remove Wordpress NoIndex (We want all IDX Broker Pages Indexed)
remove_action( 'wp_head', 'feed_links_extra', 3 ); // Hide the category feeds
remove_action( 'wp_head', 'feed_links', 2 ); // Hide the links to the general feeds: Post and Comment Feed
remove_action( 'wp_head', 'rsd_link' ); // Hide the link to the Really Simple Discovery service endpoint, EditURI link
remove_action( 'wp_head', 'wlwmanifest_link' ); // Hide the link to the Windows Live Writer manifest file.
remove_action( 'wp_head', 'index_rel_link' ); // Hide index link
remove_action( 'wp_head', 'parent_post_rel_link', 10, 0 ); // Hide prev link
remove_action( 'wp_head', 'start_post_rel_link', 10, 0 ); // Hide start link
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 ); // Hide Rel Links
remove_action( 'wp_head', 'wp_generator' ); // Hide the XHTML generator that is generated on the wp_head hook, WP version
};
add_action( 'wp_head', 'idxbroker_template_cleanup' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment