Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hide links in posts


  • virusek89
    Participant

    @virusek89

    Hello,

    How to hide links in guest posts?
    Example: “Only registered users can see links”

    Sorry for my bad English language

Viewing 1 replies (of 1 total)

  • virusek89
    Participant

    @virusek89

    Is there anyone who can help me?

    I found this code but he does not want to work

    <?php
    function hide_links($post_content) {
     if ( in_category( array( 'YOUR CAT ID', 'YOUR CAT ID') )) {
    	global $wpdb;
    
    		return ($post_content = !is_user_logged_in()?preg_replace('/<a(.*?)>(.*?)<\/a>/m', '<div style="color:red;font-size:12px;"> YOUR TEXT</div>',$post_content):$post_content);
    	 }	
    
     }
      add_filter('the_content', 'hide_links')
    
    ?>
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar