WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been browsing around Google for quite some time now, but I have yet to find a close answer.

Anyway, is there a way to limit a user to just one link (preferably outbound) per post?

share|improve this question

Take it as a starting point (not tested):

 * Limit links inside the content.
 * @param (string) $content
 * @return (string) $content
function wpse30754_limit_content_links( $content )
    // delete all <a> tags in the post
    $content = preg_replace( "/<a[^>]*><\\/a[^>]*>/", '', $content );

    return $content;
add_filter( 'the_content', 'wpse30754_limit_content_links' );

What's not yet implemented is preserving the first link. You'll need that on yourself.

share|improve this answer
Downvoting is ok, as long, as I get some feedback.... – kaiser Jul 18 '12 at 0:17

Your Answer


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.