Forums

If permalink or if url == (1 post)

  1. ikazim
    Member
    Posted 2 years ago #

    I'm working on a plugin, actually what i want to do is that
    If permalinks == [read data from sql which is url then execute]
    code
    else
    no code

    Here's the source I'm using.

    global $wpdb;
    		$sql = "SELECT re_url FROM wa_re_place WHERE re_url like '$url' ";
    		$replaces = $wpdb->get_results($sql);
    
    if ($replaces == $url) {
    	$content = preg_replace($search, $place, $content, 1);
    	return $content;
    }
    
    else {
    
    return $content; }
    
    }

    Well the_permalink(); at there didn't work so I'm using another way to get url which is $url="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

    I think the sql query isn't working. Any suggestion?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.