WordPress.org

Forums

Custom tags, custom posts and 404 issue (8 posts)

  1. domchocolate
    Member
    Posted 2 years ago #

    Hi

    I am struggling to add custom tags to custom page (portfolio). I want tags called resource tags to help navigate or find certain posts that contain links to resource files I have uploaded. Eg a tag 'Code of practice' will bring up all resources about code of practice.

    I have added the code:

    // Set up resource tags
    
    function resourcetags_init() {
    	// create a new taxonomy
    	register_taxonomy(
    		'tags',
    		'portfolio',
    		array(
    			'label' => __( 'Resource Tags' ),
    			'rewrite' => array( 'slug' => 'resourcetags' ),
    
    		)
    	);
    }
    add_action( 'init', 'resourcetags_init' );

    I have then added:

    <?php the_terms( $post->ID, 'resourcetags', 'Resource tags: ', ', ', ' ' ); ?>

    to the single-portfolio.php file to call the tags into the page.

    All of the above works apart from when I click on the tags in the page and I get a 404 error.

    I have tried using the code above and plug-ins to manage it for me and I get the same issue. Does anyone have any ideas?

  2. mindctrl
    Member
    Posted 2 years ago #

    Have you flushed the rewrite rules? This can be done by simply visiting the Settings > Permalinks page in your WP admin.

  3. domchocolate
    Member
    Posted 2 years ago #

    Hi yeah mindctrl tried that too. Any other ideas?

  4. mindctrl
    Member
    Posted 2 years ago #

    What do the links look like on the tags?

  5. domchocolate
    Member
    Posted 2 years ago #

    As simple hypertext links with a comma separating each. They render on the page fine just give an error when clicked.

  6. mindctrl
    Member
    Posted 2 years ago #

    Sorry, I meant the link structure. site.com/???/???

  7. domchocolate
    Member
    Posted 2 years ago #

    At the moment it is http://www.londonconnect.org/portfolio-tag/confidentiality/ but I have tried different variations.

  8. mindctrl
    Member
    Posted 2 years ago #

    If everything's working right, the tags should be linking to and available at http://www.londonconnect.org/resourcetags/tag-name since you're using the rewrite slug parameter.

Topic Closed

This topic has been closed to new replies.

About this Topic