Skip to content

Instantly share code, notes, and snippets.

@Abromeit
Created May 7, 2012 17:20
Show Gist options
  • Select an option

  • Save Abromeit/2629080 to your computer and use it in GitHub Desktop.

Select an option

Save Abromeit/2629080 to your computer and use it in GitHub Desktop.
Entfernung von ?rel=author aus dem Link eines WordPress-Kommentators
<?php
/* Für PHP 5.3 */
add_filter(
'preprocess_comment',
function($comment) {
if ( !empty($comment['comment_author_url']) ) {
$comment['comment_author_url'] = preg_replace(
'/(plus.google.com)(.+?)\?rel=author/',
'$1$2',
$comment['comment_author_url']
);
}
return $comment;
}
);
/* Ende für PHP 5.3 */
/* Für PHP kleiner 5.3 */
function sm_preprocess_comment($comment) {
if ( !empty($comment['comment_author_url']) ) {
$comment['comment_author_url'] = preg_replace(
'/(plus.google.com)(.+?)\?rel=author/',
'$1$2',
$comment['comment_author_url']
);
}
return $comment;
}
add_filter(
'preprocess_comment',
'sm_preprocess_comment'
);
/* Ende für PHP kleiner 5.3 */
*>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment