Support » Plugins » [Plugin: Twitter Tools] URL filter (and hashtag setting) not working…?

  • I’m trying to use the tweet_blog_post_url filter to display the default permalink structure ( — which I’d really like to see as an option in the plugin, but I’m happy enough doing a filter if I can get it to work. This code works when I dump the function’s contents into a single.php file and echo the final link, but it doesn’t seem to work as a filter:

    function tweet_default_permalink($long_url) {
    	global $wpdb;
    	$long_url = preg_replace("/\/$/","",$long_url); // remove trailing slash
    	$post_name = strrchr($long_url, '/'); // find thing from last slash onward
    	$post_name = substr($post_name, 1); // remove initial slash
    	$postID = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '$post_name' AND post_status = 'publish'");
    	$url = get_bloginfo('url')."/?p=".$postID;
    	return $url;
    add_filter('tweet_blog_post_url', 'tweet_default_permalink');

    I’d love to know what’s wrong! I searched the web for a while but never found any examples of working filters, only people giving up on the filter and hacking the plugin code.

    In other news, I can’t get Twitter Tools to append my hashtag unless I set it individually on each post. It doesn’t respect the default at all.

    TT 2.0, WP 2.8.6.

  • The topic ‘[Plugin: Twitter Tools] URL filter (and hashtag setting) not working…?’ is closed to new replies.