WordPress.org

Ready to get started?Download WordPress

Forums

redirect Category (5 posts)

  1. cableghost
    Member
    Posted 4 years ago #

    Is there a way (code or plugin) to redirect individual post categories?

    I have an ecommerce-style theme and would like my frontpage featured post categories to redirect to the product in the products page. Now, I have already set it to redirect the actual post, but the categories still go to the cat listing page.

    -Scott

  2. redsoxmaniac
    Member
    Posted 4 years ago #

    http://wpjudge.com/the-much-needed-category-redirect-plugin-is-here/

    This plugin redirects any category to any URL you choose. I don't know if this is what you are looking for.

  3. xaine05
    Member
    Posted 4 years ago #

    This plugin has broken since the 3.0 Thelonius update with a "You do not have sufficient permissions to access this page." error. Would anyone know how to fix this problem?

    Here is the code within the plugin:

    <?php
    /*
    Plugin Name: Category Redirect
    Plugin URI: http://www.wpjudge.com
    Description: Plugin for redirect the category
    Author: Marquis Hunt & Mr. Rahman (contact@webtechads.com)
    Version: 1.1
    Author URI: http://www.webtechads.com
    */
    
    ### SET THE ADMIN MENU ##
    function CatRedr_Admin_Menu(){
    
    	add_options_page("Category Redirect", "Category Redirect", 1, "Category Redirect", "CatRedr_Admin_Form");  
    
    }
    
    ## CREATE NEW TABLE TO STORE REDIRECT LINK ##
    function DB_Install(){
    	global $wpdb;
        $table = $wpdb->prefix."cat_redirect";
        $structure = "CREATE TABLE $table (
                          <code>id</code> MEDIUMINT( 10 ) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
                          <code>cat_id</code> MEDIUMINT( 10 ) NOT NULL ,
                          <code>url</code> TEXT NOT NULL
                          );";
        $wpdb->query($structure);
    
    }
    
    ### GET THE CATEGORY REDIRECT LINK FROM DB ##
    function Cat_redirect_Link($catID){
    	global $wpdb;
    	$SQL = "SELECT * FROM ". $wpdb->prefix."cat_redirect". " WHERE <code>cat_id</code> = '$catID'";
    	$Result =  $wpdb->get_results($SQL,OBJECT);
    	return $Result[0]->url;
    }
    
    ###  MAIN FUNCTION TO SHOW CATEGORY LINK ##
    function PrePare_Cat_Link($LINK,$Cat_ID){
    
    	$Cat_Link = Cat_redirect_Link($Cat_ID);
    
    	if($Cat_Link==''){
    		$Cat_Link = $LINK;
    	}
    
    	return $Cat_Link;
    
    }
    
    ## SET THE ADMIN PANEL TO CHANGE OR SET CAT REDRIRECT URL ###
    function CatRedr_Admin_Form(){
    
    	global $wpdb;
    
        include('cat_form.php');
    
    }
    
    ## CATGEORY LINK
    add_filter('category_link', 'PrePare_Cat_Link' ,10 ,2);
    ## INSTALL DB
    add_action('activate_category_redirect/category_redirect.php', 'DB_Install');
    ## CREATE ADMIN MENU
    add_action('admin_menu', 'CatRedr_Admin_Menu');  
    
    ?>
  4. joehuffman2
    Member
    Posted 4 years ago #

    Sorry, I fixed it:

    http://wpjudge.com/the-much-needed-category-redirect-plugin-is-here/

    Let me know if there are any other bugs. RsManiac foudn the issue in the codex with not having the right peramlink setup.

  5. shaneholden
    Member
    Posted 3 years ago #

    Is there a fix for this for 3.0.1? Everything works, except the actual redirect.

Topic Closed

This topic has been closed to new replies.

About this Topic