3007 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 200+ members
  • Has sold $250,000+ on Envato Market
  • Had an item featured in an Envato Bundle
+7 more
duotive says

could you post the code here please for other guys like me?:D

2468 posts
  • Has been part of the Envato Community for over 5 years
  • Has sold $100+ on Envato Market
  • Has referred 100+ members
  • Has been a beta tester for an Envato feature
+2 more
digitalimpact says
could you post the code here please for other guys like me?:D

+1, please share :)

4391 posts ThemeForest Reviewer
  • Has referred 1+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Member of the Envato Team
+12 more
Ivor Envato team says
could you post the code here please for other guys like me?:D

+1 :P

1618 posts Chris Robinson
  • Located in United States
  • Has sold $500,000+ on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has been part of the Envato Community for over 6 years
+10 more
contempoinc says

This is what I use:


if (is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) {
    //Call action that sets
    add_action('admin_head','ct_option_setup');
    //Do redirect
    header( 'Location: '.admin_url().'admin.php?page=options_panel.php' ) ;
}

688 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
_rg_ says

I guess that code wil work on a custom admin page, but if you have a simple Theme Optioins page, the path url and php page is different.

In that case i use this in my functions.php:

function my_options_add_page() {
    add_theme_page( __( 'Theme Options' ), __( 'Theme Options' ), 'administrator', 'your-theme-options-page-slug', 'my_options_do_options');
}

function my_options_do_options(){

 // do the options page here....

}

add_action( 'admin_menu', 'my_options_add_page' );

if ($_GET['activated']){
    wp_redirect(admin_url("themes.php?page=your-theme-options-page-slug"));
}

So, once theme is actived, it redirects to the Appereance > Theme Options page, which acctualy is the my_options_do_options function. I don´t need to tell the IF if i´m on themes page, since the $_GET[‘activated’] is only used there. Also, i don´t need to tell that IF ´m administrator, since the add_theme_page is restricted for “administrator” level as you can see on code.

2333 posts
  • Has referred 100+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Helped several times protecting Envato Market against copyright violations
+5 more
CreativeMilk says
This is what I use:

if (is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) {
    //Call action that sets
    add_action('admin_head','ct_option_setup');
    //Do redirect
    header( 'Location: '.admin_url().'admin.php?page=options_panel.php' ) ;
}

Where do you place this code? in the wp-includes/function.php file?

279 posts WordPress Theme Devoloper
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+7 more
kayapati says
I guess that code wil work on a custom admin page, but if you have a simple Theme Optioins page, the path url and php page is different.

In that case i use this in my functions.php:

function my_options_add_page() {
    add_theme_page( __( 'Theme Options' ), __( 'Theme Options' ), 'administrator', 'your-theme-options-page-slug', 'my_options_do_options');
}

function my_options_do_options(){

 // do the options page here....

}

add_action( 'admin_menu', 'my_options_add_page' );

if ($_GET['activated']){
    wp_redirect(admin_url("themes.php?page=your-theme-options-page-slug"));
}

The above code worked me perfectly. Thanks rg :)

279 posts WordPress Theme Devoloper
  • Has been part of the Envato Community for over 6 years
  • Has referred 1+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+7 more
kayapati says
This is what I use:

if (is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) {
    //Call action that sets
    add_action('admin_head','ct_option_setup');
    //Do redirect
    header( 'Location: '.admin_url().'admin.php?page=options_panel.php' ) ;
}

Where do you place this code? in the wp-includes/function.php file?

yes you need to add it in function.php

4391 posts ThemeForest Reviewer
  • Has referred 1+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Member of the Envato Team
+12 more
Ivor Envato team says

Thanks guys that will be very helpful for my next theme.

688 posts
  • Has been part of the Envato Community for over 7 years
  • Has referred 1+ members
  • Has sold $5,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+3 more
_rg_ says
This is what I use:

if (is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" ) {
    //Call action that sets
    add_action('admin_head','ct_option_setup');
    //Do redirect
    header( 'Location: '.admin_url().'admin.php?page=options_panel.php' ) ;
}

Where do you place this code? in the wp-includes/function.php file?

You don´t need to touch the wp includes, just in your theme/functions.php file.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by