Skip to content

Instantly share code, notes, and snippets.

@devwax
Last active December 4, 2020 20:37
Show Gist options
  • Select an option

  • Save devwax/b6d8f7e7305a15a33e3d894959339043 to your computer and use it in GitHub Desktop.

Select an option

Save devwax/b6d8f7e7305a15a33e3d894959339043 to your computer and use it in GitHub Desktop.

Revisions

  1. devwax revised this gist Dec 4, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    <?php
    /*
    Usage:
    domain.com/plugins > domain.com/wp-admin/plugins.php (WP Admin > Plugins)
  2. devwax created this gist Dec 4, 2020.
    39 changes: 39 additions & 0 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,39 @@
    /*
    Usage:
    domain.com/plugins > domain.com/wp-admin/plugins.php (WP Admin > Plugins)
    domain.com/pg > domain.com/wp-admin/edit.php?post_type=page (WP Admin > Pages)
    etc...
    */
    add_action('wp', 'redirect_shortcuts');
    function redirect_shortcuts(){
    if (is_user_logged_in()) {
    global $wp;
    $url = '';
    switch ($wp->request) {
    case 'pl':
    $url = admin_url('plugins.php');
    break;
    case 'plugins':
    $url = admin_url('plugins.php');
    break;
    case 'pg':
    $url = admin_url('edit.php?post_type=page');
    break;
    case 'pages':
    $url = admin_url('edit.php?post_type=page');
    break;
    case 'media':
    $url = admin_url('upload.php');
    break;
    case 'jch':
    $url = admin_url('options-general.php?page=jchoptimize-settings');
    break;
    default:
    break;
    }
    if ($url) {
    wp_safe_redirect($url);
    }
    return;
    }
    }