[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 704
  • Last Modified:

wordpress strange prints

I set up a wordpress website based on wordpress 3.1.2 version

Every page of wordpress is getting <meta name="robots" content="noindex,nofollow" />

The privacy setting in admin area are set to public, if I set it private then I get it twice.

However, if I remove wp_head from header.php,  the line goes away. I found 2 files default-filters.php and general-template.php in includes directory. I made every no index function to null and I still get that line.

How can I get rid of that noindex nofollow ? Basically where else does wp_head has it's hooks defined?

Edit : It's not coming from theme files, I double checked it by installing theme on a different location.
0
shawnlearn
Asked:
shawnlearn
  • 9
  • 7
1 Solution
 
LZ1Commented:
Can you show a live link? It should be in your header file of your theme.
0
 
shawnlearnAuthor Commented:
Attached is the code for header file, the HTML isn't there but wp_head is printing that line with noindex etc..

If we could located where the wp_head is getting metadata from we can trim that piece of code, Possibly!
<!DOCTYPE html>
<html <?php language_attributes(); ?>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>" />
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="theme author" href="ZHAO Xudong,zxdong@gmail.com" />
<title><?php wp_title(''); ?>|<?php $paged = get_query_var('paged'); if($paged>1) printf('page %s',$paged); ?><?php if(is_tag()) printf('tag-'); ?><?php if(is_category()) printf('category-'); ?> <?php bloginfo('name'); ?></title>
<?
	require_once (WP_PLUGIN_DIR."/gravityforms/common.php");
	require_once(GFCommon::get_base_path() . "/form_display.php");
	$form = RGFormsModel::get_form_meta(3);
	GFFormDisplay::enqueue_form_scripts($form);
	wp_print_scripts();
?>
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />

<?php if ($post->ID==222) { ?>
<script type="text/javascript" src="example.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="example.css" />

<script language="javascript">

$(document).ready(function(){

	//show loading bar

	function showLoader(){

		$('.search-background').fadeIn(200);

	}
   
	//hide loading bar

	function hideLoader(){

		$('#sub_cont').fadeIn(1500);

		$('.search-background').fadeOut(200);

	};

	

	$('#search').keyup(function(e) {

  	//var srchval = $("#search").val();
	//alert(srchval);
  

      if(e.keyCode == 13) {

  

      	showLoader();

		$('#sub_cont').fadeIn(1500);

		$("#content #sub_cont").load("search.php?val=" + $("#search").val()+"&city="+$("#cityname").val()+"&state="+$("#state").val()+"&ssnumber="+$("#ssnumber").val()+"&licidnumber="+$("#licidnumber").val(), hideLoader());



      }

  

      });

	  

	$(".searchBtn").click(function(){

	

		//show the loading bar

		showLoader();

		$('#sub_cont').fadeIn(1500);

		  

		$("#content #sub_cont").load("search.php?val=" + $("#search").val()+"&city="+$("#cityname").val()+"&state="+$("#state").val()+"&ssnumber="+$("#ssnumber").val()+"&licidnumber="+$("#licidnumber").val(), hideLoader());



	});

});

</script>
<?php } ?>

<?php wp_head();?>
</head>
<body <?php body_class(); ?>>
	<div id="wrap-bgt">
		<div id="wrap-bgb">
			<div id="wrapper" class="fix">
				<div id="header">
					<div class="keys"></div>
					<a href="<?php echo home_url( '/' );?>" class="examplee"></a>
					<?php //get_search_form(); ?>
					<!--<a style="    color: #FFFFFF; float: left;  font-size: 15px; height: 30px;  margin-top: 60px;" href="<?php echo home_url( '/' );?>?page_id=222"> Search for Tenants </a>-->
                     <input type="button" name="" value=""  style="n.png) no-repeat; border:none; height: 39px; margin-top: 50px; width: 153px; cursor: pointer;" onClick="javascript:window.location='<?php echo home_url( '/' );?>?page_id=222';"/>
					<?php get_template_part('nav'); ?>
				</div><!-- /header -->
				<div class="clear"></div>

Open in new window

0
 
LZ1Commented:
Can you upload your theme here and then we can take a look to see if we can find the culprit. It may be buried in a functions file or something.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
shawnlearnAuthor Commented:
I can upload the theme, but when I installed the theme at different location I didn't get this error.

So just to be sure do you want me to upload any other file with the theme files?
0
 
LZ1Commented:
Ok, what about plugins then? Do you have any SEO plugins installed? If not, try installing the All-in-One SEO plugin, configure it and see if that will maybe overwrite the current issue.
0
 
shawnlearnAuthor Commented:
Here's the code for functions.php file.
<?php
    if ( ! isset( $content_width ) ){
		        $content_width = 600;
		} 
		        add_theme_support( 'post-thumbnails' ); // Add it for posts
		        add_theme_support('automatic-feed-links'); 

    register_nav_menus( array(
		        'primary' => __( 'Primary Navigation', 'cssfever' ),
				'secondary' => __( 'Secondary Navigation', 'cssfever' ),
				'example' => __( 'example Navigation', 'cssfever' ),
				'proexample' => __( 'Pro example Navigation', 'cssfever' ),
				)
		);

//widget function,from twentyten theme
    function cssfever_widgets_init() {
	// Area 1, located at the top of the sidebar.
                register_sidebar( array(
				        'name' => __( 'Primary Widget Area', 'cssfever' ),
						'id' => 'primary-widget-area',
						'description' => __( 'The primary widget area', 'cssfever' ),
						'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
						'after_widget' => '</div>',
						'before_title' => '<div class="sidebartitle"><h3 class="widget-title">',
						'after_title' => '</h3></div>',
						) 
				);
		}
    add_action( 'widgets_init', 'cssfever_widgets_init' );
/** Register sidebars by running cssfever_widgets_init() on the widgets_init hook. */
       
/**some function modified */
        if ( !is_admin() ) {
// add google analytics to footer
		            function cssfever_init_method() {
                                        wp_register_script( 'cssfever', get_template_directory_uri().'/js/cssfever.js' ,array('jquery'),'0.1',true); 
				                        wp_enqueue_script( 'cssfever');
				                        wp_deregister_script( 'jquery' );
				                        wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js' ,false,'1.4.4',true); 
				                        wp_enqueue_script( 'jquery');
				       }
				       add_action('init', 'cssfever_init_method'); 
		}
		function cssfever_browser_body_class($classes) {
		        global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
				if($is_lynx) $classes[] = 'lynx';
				elseif($is_gecko) $classes[] = 'gecko';
				elseif($is_opera) $classes[] = 'opera';
				elseif($is_NS4) $classes[] = 'ns4';
				elseif($is_safari) $classes[] = 'safari';
				elseif($is_chrome) $classes[] = 'chrome';
				elseif($is_IE){
				        $classes[] = 'ie';
						//if the browser is IE6
						if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 6') !== false){
						        $classes[] = 'ie6'; //add 'ie6' class to the body class array
						}
				}
				else $classes[] = 'unknown';
				if($is_iphone) $classes[] = 'iphone';
				return $classes;
		}
		add_filter('body_class','cssfever_browser_body_class'); 
                function cssfever_post_expander_show_post (  ) {
                         if ( have_posts() ) {
                              while ( have_posts() ) {
                               the_post();
                               the_content();
                               }
                         }
                         die();
                 }
function cssfever_post_expander_activate ( ) {
  if ( isset( $_POST["post_expander"] ) ) {
    add_action( 'wp', 'cssfever_post_expander_show_post' );
  }
}
add_action('init', 'cssfever_post_expander_activate');
class zxdRoboCheck{
	function zxd_robokiller_fields($fields) {
		$rnum1 =rand(1,10);
		$rnum2 = rand(2,8);
		$rnum = $rnum1 + $rnum2;
		$fields['robo'] = '<p class="comment-form-robo"><label for="robo">'.$rnum1.'+'.$rnum2.'=?'.__('(robot check)').'</label> <span class="required">*</span><input id="robo" name="robo" type="text" value="" size="30" aria-required="true" /><input id="rnum" name="rnum" type="hidden" value="'.$rnum.'" size="0" aria-required="true" class="hide" /></p> ';
		return $fields;
	}
	function roboCheck($comment){
                $user_id=get_current_user_id( );
                if($user_id !=0) return($comment);
		if (empty($_POST['robo']) || trim($_POST['robo']) == '' ) {
			wp_die( __('Error: you are not robot,are you?do the math,fill the blank '));
		}
		$robo_num1 = (int)$_POST['robo'];
		$robo_num2 = (int)$_POST['rnum'];
		if ( $robo_num2 == $robo_num1) {
			return($comment);
		} 
		else {
			wp_die( __('Error: you are not robot,are you?'));
		}
	}
}
if (class_exists("zxdRoboCheck")) {
  $aRoboCheck = new zxdRoboCheck();
  add_action('comment_form_default_fields', array(&$aRoboCheck, 'zxd_robokiller_fields'),1);
  add_filter('preprocess_comment', array($aRoboCheck, 'roboCheck'), 1);
}
function fb_show_admin_bar() {
 if ( current_user_can( 'manage_options' ) )
 return TRUE;
 else
 return FALSE;
 }
 add_filter( 'show_admin_bar', 'fb_show_admin_bar' );

 function add_twitter_contactmethod( $contactmethods ) {
  unset($contactmethods['aim']);
  unset($contactmethods['jabber']);
  unset($contactmethods['yim']);
  unset($contactmethods['user_url']);

  
  return $contactmethods;
}
add_filter('user_contactmethods','add_twitter_contactmethod',10,1);

function admin_del_options() {
   global $_wp_admin_css_colors;
   $_wp_admin_css_colors = 0;
}

add_action('admin_head', 'admin_del_options');

/* Restrict access to profile entirely */
function restrict_admin(){
	global $current_user;
	get_currentuserinfo();

	//if not admin, die with message
	if ( $current_user->user_level <  8 ) {
		wp_die( __('You are not allowed to access this part of the site') );
	}
}
add_action( 'admin_init', 'restrict_admin', 1 );


function remove_plain_bio($buffer) {
		$titles = array('#<h3>About Yourself</h3>#','#<h3>About the user</h3>#');
		$buffer=preg_replace($titles,'<h3>Password</h3>',$buffer,1);
		$biotable='#<h3>Password</h3>.+?<table.+?/tr>#s';
		$buffer=preg_replace($biotable,'<h3>Password</h3> <table class="form-table">',$buffer,1);
		return $buffer;
	}

	function profile_admin_buffer_start() { ob_start("remove_plain_bio"); }

	function profile_admin_buffer_end() { ob_end_flush(); }

	add_action('admin_head', 'profile_admin_buffer_start');
	add_action('admin_footer', 'profile_admin_buffer_end');



	// checks they are authoized
function auth_redirect_login() {
$user = wp_get_current_user();
if ( $user->id == 0 ) {
nocache_headers();
wp_redirect(get_option('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
exit();
}
}
	
function caption_shortcode( $atts, $content = null ) {
	$logouturl = wp_logout_url( get_permalink() );
   return '<a href="'.$logouturl.' ">' . $content . '</a>';
}	
add_shortcode( 'caption', 'caption_shortcode' );
 
 
add_filter('wp_nav_menu_items', 'add_login_logout_link', 10, 2);
function add_login_logout_link($items, $args) {
 
		

	   $logoutURL= wp_logout_url( get_permalink() );
        if ( is_user_logged_in() ) {
		
        $loginoutlink = '<a href="'.$logoutURL.'" title="Logout">Logout</a>';
		
} else {
		$loginoutlink = '<a href="http://example1.com/?page_id=20" title="Login">Login</a>';
}
       
 
        $items .= '<li class="menu-item">'. $loginoutlink .'</li>';
 
    return $items;
}
 
 // mt_add_pages() is the sink function for the 'admin_menu' hook
function mt_add_pages() {
    // Add a new top-level menu:
   // The first parameter is the Page name(Site Help), second is the Menu name(Help)
   //and the number(5) is the user level that gets access
    add_menu_page('Tenant Report It', 'Tenant Report It', 5, 'mt_toplevel_page','mt_toplevel_page');
}
// mt_toplevel_page() displays the page content for the custom Test Toplevel menu
function mt_toplevel_page() { ?>
	<iframe frameborder="0" src="<?php _e(get_option('siteurl')); ?>/wp-content/plugins/gravityforms/tenant-admin-form.php?id=12" style="border:none;width:100%;height:3000px;"></iframe>
<?php	
}
// Insert the mt_add_pages() sink into the plugin hook list for 'admin_menu'
add_action('admin_menu', 'mt_add_pages');
 
 //---------- Add filter after the theme is set up
add_action( 'after_setup_theme', 'NLI_website_redirect_setup', 11 );

function NLI_website_redirect_setup() {
    add_filter('login_redirect', 'NLI_global_redirect', 10, 3);
}

// --------- This function prevents WP from sending incorrect logins to the out-of-the-box WordPress Admin wp-logon.php page
// --------- ALL Incorrect logins are sent to the "general-website-login.php" page
// --------- Unintentional Side-effect: Not-logged-in Admins typing in /wp-admin or /wp-login.php will get redirected to this page too
// --------- Correct logins are processed ON THE PAGE via the default WordPress wp_login_form() 'redirect' argument specified on the page
function NLI_global_redirect() {
    $location = "http://example1.com/?page_id=20/";
    wp_safe_redirect($location);
    exit();
}
remove_action('wp_head', 'wp_generator');
?>

Open in new window

0
 
LZ1Commented:
What about any plugins?
0
 
shawnlearnAuthor Commented:
Yeah I already have Allinone SEO.   It doesn't overwrite the html line but pushes it down further.

This is how it appears then

line 39  <!-- /all in one seo pack -->
line 40 <meta name="robots" content="noindex,nofollow" />

Only thing which has helped me get rid of this meta tag is removing "wp_head"
so  I don't know wp_head is getting this from?
0
 
shawnlearnAuthor Commented:
Other plugin that I have are

gravity forms
wishlist
Fast Secure Contact Form
Membership-Details
0
 
LZ1Commented:
I wonder if the Membership-Details has anything to do with it. Can you disable the plugins 1 by 1 and then check the source?
0
 
shawnlearnAuthor Commented:
okay let's try.

any specific order that I should follow?
0
 
LZ1Commented:
Not really. I generally just do top to bottom, that way it's easier to keep track.  Also make sure to delete and remove any plugins that you are not going to be using.
0
 
shawnlearnAuthor Commented:
LZ1 - that did it. I checked in plugins folder I had a plugin which i wasn't using any longer and it stopped showing up in admin area for some reason... I deleted that plugin and meta junk disappeared!!!


Thanx a ton!
0
 
shawnlearnAuthor Commented:
Thanx LZ1
0
 
LZ1Commented:
No problem! Glad to help.
0
 
shawnlearnAuthor Commented:
The problem was small but I learnt about filters and hooks. :)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 9
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now