Skip to content

Instantly share code, notes, and snippets.

@westi
westi / Always show admin bar
Created January 7, 2011 13:29
I like the admin bar that we are adding in the soon to be released WordPress 3.1 so much that I wanted it to always show on my site. This way you get an easy to use search box on every page even when logged out. I wrote a quick plugin file which I dro
<?php
function pjw_login_adminbar( $wp_admin_bar) {
if ( !is_user_logged_in() )
$wp_admin_bar->add_menu( array( 'title' => __( 'Log In' ), 'href' => wp_login_url() ) );
}
add_action( 'admin_bar_menu', 'pjw_login_adminbar' );
add_filter( 'show_admin_bar', '__return_true' , 1000 );
<?php
function cwws_deactivate() {
// to undo - Holy crap!
global $wp_rewrite;
// Remove the 'json' endpoint.
$old_ends = $wp_rewrite->endpoints;
$wp_rewrite->endpoints = array();
foreach ( $old_ends as $_end ) {
list( $_places, $_name ) = $_end;