Skip to:

Create a group via WP_Admin

  • Hunnie


    I have a requirement to only allow group creation from the wp-admin.

    the wp-admin/groups/index page ‘Add New’ button takes us to the front end /groups/create page.

    I don’t want to amend core files does anybody have any pointers as to how I can achieve this?

    I have tried to redirect (for the moment to the edit page as a test) but this is failing and always takes me to the front-end create page:

    add_action('init', 'rewrite_admin_group_create');
    function rewrite_admin_group_create() 
       global $wp_rewrite;
       $wp_rewrite->add_rule('groups/create/', 'wp-admin/admin.php?page=bp-groups&action=edit&gid=2','top');

    I’m using WP: 3.8.1 and BP: 1.9.1


Viewing 1 replies (of 1 total)
  • I don’t know the solution to the question, but I saw your code — don’t call flush_rules() on every page load. It will seriously slow down your site. You don’t need it at all, since you’re adding the same rule on every page load. (You can go to wp-admin > Settings > Permalinks which will force WP to clear the rewrite rules cache).

Viewing 1 replies (of 1 total)
  • The topic ‘Create a group via WP_Admin’ is closed to new replies.
Skip to toolbar