bbPress::add_permastructs()

Add permalink structures for new archive-style destinations.

Description

  • Users
  • Topic Views
  • Search

Source

File: bp-forums/classes/class-bbpress.php

    public static function add_permastructs() {

        // Get unique ID's
        $user_id     = bbp_get_user_rewrite_id();
        $view_id     = bbp_get_view_rewrite_id();
        $search_id   = bbp_get_search_rewrite_id();

        // Get root slugs
        $user_slug   = bbp_get_user_slug();
        $view_slug   = bbp_get_view_slug();
        $search_slug = bbp_get_search_slug();

        // User Permastruct
        add_permastruct( $user_id, $user_slug . '/%' . $user_id . '%', array(
            'with_front'  => false,
            'ep_mask'     => EP_NONE,
            'paged'       => false,
            'feed'        => false,
            'forcomments' => false,
            'walk_dirs'   => true,
            'endpoints'   => false,
        ) );

        // Topic View Permastruct
        add_permastruct( $view_id, $view_slug . '/%' . $view_id . '%', array(
            'with_front'  => false,
            'ep_mask'     => EP_NONE,
            'paged'       => false,
            'feed'        => false,
            'forcomments' => false,
            'walk_dirs'   => true,
            'endpoints'   => false,
        ) );

        // Search Permastruct
        add_permastruct( $user_id, $search_slug . '/%' . $search_id . '%', array(
            'with_front'  => false,
            'ep_mask'     => EP_NONE,
            'paged'       => true,
            'feed'        => false,
            'forcomments' => false,
            'walk_dirs'   => true,
            'endpoints'   => false,
        ) );
    }

Changelog

Changelog
Version Description
bbPress (r4930) Introduced.

Questions?

We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.