Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm currently having some difficulties getting this below snippet to work. The current outcome is it replaces nothing.

I realize this particular question could also be solved using gettext, but I was looking a general example solving all of my str_replace questions at once.

add_filter( 'admin_print_scripts-index.php', 'wpse_replace_version_message' );
/**
 * wpse_replace_version_message
 */
function wpse_replace_version_message( $html ) {
  $html = str_replace( '<span id=\'wp-version-message\'>You are using <span class="b">WordPress 3.4-alpha-19904</span>', '', $html );
  return $html;
}
share|improve this question

1 Answer 1

up vote 0 down vote accepted

I haven't tested this code, but I think it will work for you. I just put add_filter after the function and chose preg_replace:

<?php
/**
 * wpse_replace_version_message
 */
function wpse_replace_version_message( $html ) {
  $html = preg_replace( '<span id=\'wp-version-message\'>You are using <span class="b">WordPress 3.4-alpha-19904</span>', '', $html );
  return $html;
  }
add_filter( 'admin_print_scripts-index.php', 'wpse_replace_version_message' );
?>
share|improve this answer
    
thanks @jeremy-jared :) –  Cor van Noorloos Feb 12 '12 at 23:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.