Surgical Speed: Add Quick Access Links to Your WordPress Dashboard

Table of Contents

If you open the same WordPress admin pages repeatedly, you are burning valuable development time. Instead of constantly hovering through deep, nested sidebars, you can place your favorite settings directly on the main dashboard screen for instant, one-click execution.

Specifically, this workflow optimization is incredibly powerful for pages hidden deep inside submenus. For example, it cleanly targets navigation management, layout template libraries, form builders, or custom code repositories. 🏎️💨

⚡ What a WordPress Quick Access Panel Does

The Layout Blueprint Explained 🗺️

A dashboard quick access panel acts as a centralized, lightweight shortcuts box inside your WordPress admin area. Rather than forcing you to traverse the left-hand admin sidebar every single time, it lets you click once right from the main login screen and jump straight to your destination.

Prime Targets for Dashboard Shortcuts:

  • Appearance > Menus (For rapid navigation adjustments)

  • Deep Plugin Settings (Bypassing long setup paths)

  • Theme Template Libraries (For page-builder focused developers)

  • Custom Font Managers or Global Style Areas

Ultimately, the primary benefit here is pure operational speed. Because it completely eliminates repetitive hover movements, it makes the entire WordPress admin interface feel tailored to your specific working habits. 🧠

🧩 Who This Workflow Benefits Most

Optimizing the Creator Workspace 💻

This specialized dashboard configuration acts as a foundational asset for several distinct groups. For instance, Agencies & Freelancers demand a lightning-fast admin workspace during rapid site builds. Consequently, shortcuts drastically reduce their daily friction.

Streamlining Daily Content Management 🏛️

Furthermore, Independent Site Owners who manage their own day-to-day content architecture benefit heavily. Similarly, Designers & Developers who constantly bounce between frontend templates and raw code areas save massive amounts of time.

Therefore, if your admin sidebar already feels cluttered from “plugin soup,” transitioning to clean dashboard shortcuts provides a far more streamlined alternative.

🛠️ How to Add Quick Links in WordPress

Preparing Your Environment ⚙️

To deploy this setup cleanly without introducing heavy site bloat, we use a lightweight, open-source code snippet handled safely through the Code Snippets dashboard. First, ensure you have the core Code Snippets plugin activated on your production site.

Injecting the Custom Shortcut Logic 💉

Subsequently, add the custom quick access code snippet into your repository. Once you save and execute the snippet globally, a new settings page will reveal itself. Next, open this freshly generated settings page to view your options.

Selecting Your Core Admin Links 📋

Finally, simply check the specific admin menus you want pinned directly to your main screen. As a result of this configuration, your new navigation grid goes instantly live right on your main dashboard screen. 🏎️

📋 Curating Your Shortcut Matrix

Selecting High-Frequency Targets 🎯

To maintain a clean, distraction-free environment, avoid the temptation to pin every single page. The smartest structural approach is to select only the endpoints that you use on a daily basis. For example, try to target sections that take at least three clicks to reach.

The Blueprint Rules for Pinned Links 🔍

An ideal shortcut target usually meets these specific layout rules:

  • It is hidden at least two or three layers deep within a submenu string.

  • You must interact with it multiple times throughout a standard production week.

  • It resides inside a comprehensive plugin that features complex internal navigation tabs.

Therefore, try to keep your shortcut panel highly focused. A small, elite selection of genuinely useful navigation points is infinitely more effective than turning your dashboard into another cluttered wall of links. 💎

⚠️ Critical Workflow Mistakes to Avoid

Managing the Shortcut Grid Layout 🛑

First, avoid Overloading the Matrix. If you pin forty different things to the screen, the panel completely loses its speed advantage. As a result, you should keep your selections strictly limited to high-frequency targets.

Handling Software Updates Safely 🔧

Second, remember to run a menu rescan after plugin changes. If an interactive plugin updates its internal admin paths, your shortcut may break. Therefore, running a rapid scan from the settings panel keeps your dashboard perfectly current.

Finally, protect your layout sandbox. Specifically, you should focus your choices on primary admin menu destinations rather than deep, internal third-party plugin buttons that may not render correctly in a small widget box. 🛡️

🏁 Final Takeaway

In conclusion, if you spend several hours a week operating inside the WordPress admin environment, dropping a custom dashboard quick access panel into place is an incredible optimization step. It keeps your primary development tools exactly one click away, eliminates tedious hover trees, and makes the default dashboard far more functional.

				
					/**
 * Quick Links (Dashboard Only) — Hardened (no critical errors)
 */
if ( ! defined('ABSPATH') ) exit;

class WSQA_Dashboard_Only_V6 {
	const META_CATALOG  = 'wsqa_catalog_v6';   // array: id => item
	const META_SELECTED = 'wsqa_selected_v6';  // ordered array of ids
	const PAGE_SLUG     = 'wsqa-v6';
	const AJAX_ACTION   = 'wsqa_scan_v6';
	const NONCE_ACTION  = 'wsqa_v6_nonce';

	public static function init() {
		add_action('admin_menu', [__CLASS__, 'add_settings_page']);
		add_action('wp_dashboard_setup', [__CLASS__, 'add_dashboard_widget']);

		add_action('admin_enqueue_scripts', [__CLASS__, 'enqueue_assets']);
		add_action('admin_head-index.php', [__CLASS__, 'dashboard_css']);

		add_action('admin_init', [__CLASS__, 'handle_save']);
		add_action('wp_ajax_' . self::AJAX_ACTION, [__CLASS__, 'ajax_scan_save']);
	}

	public static function add_settings_page() {
		add_options_page(
			'Quick Access',
			'Quick Access',
			'read',
			self::PAGE_SLUG,
			[__CLASS__, 'render_settings_page']
		);
	}

	public static function add_dashboard_widget() {
		wp_add_dashboard_widget(
			'wsqa_widget_v6',
			'Quick Access',
			[__CLASS__, 'render_dashboard_widget']
		);
	}

	public static function dashboard_css() {
		?>
		<style>
			.wsqa6-wrap { margin:-12px; padding:12px; background:#fafafa; }
			.wsqa6-group { margin:0 0 15px; }
			.wsqa6-title{
				font-size:12px; font-weight:700; color:#1e1e1e;
				margin:0 0 2px 0; text-transform:uppercase; letter-spacing:.05em;
			}
			.wsqa6-links{ list-style:none; margin:0; padding:0; display:flex; flex-wrap:wrap; gap:8px; }
			.wsqa6-links a{
				display:inline-flex; align-items:center;
				padding:5px 15px; border:1px solid #D0D0CE;
				border-radius:25px; background:#fff;
				text-decoration:none; color:#1d2327;
				font-size:12px; transition:all .2s ease-in-out;
			}
			.wsqa6-links a:hover{ background:#f6f7f7; border-color:#a7aaad; color:#2271b1; }
			.wsqa6-label{ font-weight:500; }
			.wsqa6-pill{ display:none; }
			.wsqa6-edit{ margin:15px 0 0; font-size:12px; border-top:1px solid #e5e5e5; padding-top:10px; }
		</style>
		<?php
	}

	public static function render_dashboard_widget() {
		$catalog  = self::get_catalog();   // hardened
		$selected = self::get_selected();  // hardened

		$items = [];
		foreach ($selected as $id) {
			if (!is_string($id) || $id === '') continue;
			if (!isset($catalog[$id]) || !is_array($catalog[$id])) continue;

			$it = self::sanitize_item($catalog[$id]);
			if (!$it) continue;

			if (!empty($it['cap']) && !current_user_can($it['cap'])) continue;
			$items[] = $it;
		}

		if (empty($items)) {
			echo '<p style="margin:0;">No quick links yet.</p>';
			echo '<p style="margin:8px 0 0;"><a href="'.esc_url(admin_url('options-general.php?page='.self::PAGE_SLUG)).'">Scan and choose quick links</a></p>';
			return;
		}

		$grouped = [];
		foreach ($items as $it) {
			$p = !empty($it['parent']) ? $it['parent'] : 'Other';
			if (!isset($grouped[$p])) $grouped[$p] = [];
			$grouped[$p][] = $it;
		}

		echo '<div class="wsqa6-wrap">';
		foreach ($grouped as $parent => $links) {
			echo '<div class="wsqa6-group">';
			echo '<div class="wsqa6-title">'.esc_html($parent).'</div>';
			echo '<ul class="wsqa6-links">';
			foreach ($links as $l) {
				if (!is_array($l)) continue;
				$url = self::normalize_admin_url(isset($l['url']) ? $l['url'] : '');
				$label = isset($l['label']) ? $l['label'] : '';
				if ($url === '' || $label === '') continue;

				echo '<li><a href="'.esc_url($url).'">';
				echo '<span class="wsqa6-label">'.esc_html($label).'</span>';
				echo '</a></li>';
			}
			echo '</ul></div>';
		}
		echo '<p class="wsqa6-edit"><a href="'.esc_url(admin_url('options-general.php?page='.self::PAGE_SLUG)).'">Edit quick links</a></p>';
		echo '</div>';
	}

	public static function enqueue_assets($hook) {
		if ($hook !== 'settings_page_' . self::PAGE_SLUG) return;

		wp_enqueue_script('jquery-ui-sortable');
		$nonce = wp_create_nonce(self::NONCE_ACTION);
		$ajax  = admin_url('admin-ajax.php');

		$js = "
jQuery(function($){
  function syncOrder(){
    var order = [];
    $('#wsqa6-selected li').each(function(){
      var id = $(this).attr('data-id');
      if (id) order.push(id);
    });
    $('#wsqa6_order').val(order.join(','));
  }

  $('#wsqa6-selected').sortable({ handle: '.wsqa6-handle', update: syncOrder });

  function escapeHtml(s){
    s = String(s || '');
    return s.replace(/[&<>\"']/g, function(m){
      return ({'&':'&amp;','<':'&lt;','>':'&gt;','\"':'&quot;',\"'\":'&#039;'}[m]);
    });
  }

  $(document).on('click', '.wsqa6-remove', function(){
    var li = $(this).closest('li');
    var id = li.attr('data-id');
    li.remove();
    $('#wsqa6-catalog input[type=checkbox][value=\"'+id+'\"]').prop('checked', false);
    syncOrder();
  });

  $(document).on('change', '#wsqa6-catalog input[type=checkbox]', function(){
    var cb = $(this);
    var id = cb.val();
    var parent = cb.attr('data-parent') || 'Other';
    var label = cb.attr('data-label') || '';
    if (cb.is(':checked')) {
      if ($('#wsqa6-selected li[data-id=\"'+id+'\"]').length) { syncOrder(); return; }
      $('#wsqa6-selected').append(
        '<li class=\"wsqa6-sel\" data-id=\"'+id+'\">'
        + '<span class=\"wsqa6-handle\" aria-hidden=\"true\">☰</span>'
        + '<span class=\"wsqa6-sel-text\"><strong>'+escapeHtml(parent)+'</strong> — '+escapeHtml(label)+'</span>'
        + '<button type=\"button\" class=\"wsqa6-remove\" aria-label=\"Remove\">✕</button>'
        + '</li>'
      );
    } else {
      $('#wsqa6-selected li[data-id=\"'+id+'\"]').remove();
    }
    syncOrder();
  });

  function hashId(s){
    s = String(s || '').toLowerCase();
    var h = 0, i, chr;
    for (i = 0; i < s.length; i++) { chr = s.charCodeAt(i); h = ((h << 5) - h) + chr; h |= 0; }
    if (h < 0) h = h * -1;
    return 'wsqa6_' + h;
  }

  function cleanText(t){
    return String(t || '').replace(/\\s+/g, ' ').replace(/^\\s+|\\s+$/g,'');
  }

  function addItem(items, parent, label, url, source){
    if (!label || !url) return;
    var id = hashId(parent + '|' + label + '|' + url);
    items.push({ id: id, parent: parent, label: label, url: url, source: source || '' });
  }

  function scrapeAdminMenu(){
    var items = [];
    var menu = document.getElementById('adminmenu');
    if (!menu) return items;
    var lis = menu.children;
    for (var i=0; i<lis.length; i++){
      var li = lis[i];
      if (!li || !li.querySelector) continue;
      var topA = li.querySelector(':scope > a') || li.querySelector('a');
      var parent = cleanText(topA ? topA.textContent : '') || 'Other';
      var subs = li.querySelectorAll('ul.wp-submenu a');
      for (var j=0; j<subs.length; j++){
        var a = subs[j];
        var label = cleanText(a.textContent);
        var url = a.getAttribute('href');
        if (!url || url === '#' || url.indexOf('javascript:') === 0) continue;
        addItem(items, parent, label, url, 'Admin Menu');
      }
    }
    return items;
  }

  function walkObject(obj, out, depth){
    if (!obj || typeof obj !== 'object') return;
    if (depth > 8) return;
    if (typeof obj.title === 'string' && typeof obj.url === 'string') {
      var label = cleanText(obj.title);
      var url = obj.url;
      if (label && url) addItem(out, 'Elementor', label, url, 'Elementor');
    }
    for (var k in obj){
      if (!Object.prototype.hasOwnProperty.call(obj, k)) continue;
      var v = obj[k];
      if (v && typeof v === 'object') walkObject(v, out, depth + 1);
    }
  }

  function scrapeElementorGlobals(){
    var out = [];
    var candidates = [ window.elementorCommonConfig, window.elementorAppProConfig, window.elementor ];
    for (var i=0; i<candidates.length; i++){
      try { walkObject(candidates[i], out, 0); } catch(e){}
    }
    return out;
  }

  function uniqById(arr){
    var seen = {};
    var out = [];
    for (var i=0; i<arr.length; i++){
      var it = arr[i];
      if (!it || !it.id) continue;
      if (seen[it.id]) continue;
      seen[it.id] = true;
      out.push(it);
    }
    return out;
  }

  $('#wsqa6-scan').on('click', function(e){
    e.preventDefault();
    var btn = $(this);
    btn.prop('disabled', true).text('Scanning…');
    try {
      var items = [];
      items = items.concat(scrapeAdminMenu());
      items = items.concat(scrapeElementorGlobals());
      items = uniqById(items);
      $.post('{$ajax}', {
        action: '".self::AJAX_ACTION."',
        _ajax_nonce: '{$nonce}',
        items_json: JSON.stringify(items)
      }).done(function(resp){
        if (resp && resp.success) {
          window.location.reload();
        } else {
          alert('Scan failed.');
        }
      }).fail(function(){
        alert('Scan failed.');
      }).always(function(){
        btn.prop('disabled', false).text('Scan Now');
      });
    } catch(err) {
      btn.prop('disabled', false).text('Scan Now');
    }
  });

  syncOrder();
});
";
		wp_add_inline_script('jquery-ui-sortable', $js);

		$css = "
.wsqa6-grid{ display:grid; grid-template-columns: 1fr 1fr; gap:16px; max-width:1200px; }
@media (max-width: 960px){ .wsqa6-grid{ grid-template-columns:1fr; } }
.wsqa6-panel{ background:#fff; border:1px solid #ccd0d4; border-radius:14px; padding:14px; }
#wsqa6-selected{ list-style:none; margin:0; padding:0; }
#wsqa6-selected li{
  display:flex; align-items:center; gap:10px;
  padding:10px 12px; margin:8px 0;
  border:1px solid #dcdcde; border-radius:12px; background:#fff;
}
.wsqa6-handle{ cursor:grab; user-select:none; font-size:16px; color:#50575e; }
.wsqa6-sel-text{ flex:1; font-weight:600; }
.wsqa6-remove{
  border:1px solid #d0d7de; background:#fff; border-radius:10px;
  width:32px; height:32px; cursor:pointer; font-weight:800; color:#b32d2e;
}
.wsqa6-remove:hover{ background:#f6f7f7; }
.wsqa6-details{ border:1px solid #e5e7eb; border-radius:12px; padding:10px; margin:10px 0; }
.wsqa6-details summary{ cursor:pointer; font-weight:700; }
.wsqa6-item{ display:block; padding:10px; border:1px solid #e5e7eb; border-radius:12px; margin:8px 0; }
";
		wp_add_inline_style('common', $css);
	}

	public static function render_settings_page() {
		if (!current_user_can('read')) return;

		$catalog  = self::get_catalog();   // hardened
		$selected = self::get_selected();  // hardened

		$clean = [];
		foreach ($selected as $id) {
			if (is_string($id) && $id !== '' && isset($catalog[$id]) && is_array($catalog[$id])) {
				$clean[] = $id;
			}
		}
		$selected = $clean;
		?>
		<div class="wrap">
			<h1>Quick Access (Dashboard Only)</h1>
			<form method="post">
				<?php wp_nonce_field(self::NONCE_ACTION, '_wsqa6_nonce'); ?>
				<input type="hidden" id="wsqa6_order" name="wsqa6_order" value="" />
				<div class="wsqa6-grid">
					<div class="wsqa6-panel">
						<h2 style="margin-top:0;">Selected</h2>
						<ul id="wsqa6-selected">
							<?php if (!$selected): ?>
								<li style="opacity:.75;">Nothing selected yet.</li>
							<?php else: ?>
								<?php foreach ($selected as $id): ?>
									<?php
									$it = isset($catalog[$id]) && is_array($catalog[$id]) ? self::sanitize_item($catalog[$id]) : null;
									if (!$it) continue;
									?>
									<li class="wsqa6-sel" data-id="<?php echo esc_attr($id); ?>">
										<span class="wsqa6-handle">☰</span>
										<span class="wsqa6-sel-text"><strong><?php echo esc_html($it['parent']); ?></strong> — <?php echo esc_html($it['label']); ?></span>
										<button type="button" class="wsqa6-remove">✕</button>
									</li>
								<?php endforeach; ?>
							<?php endif; ?>
						</ul>
						<p><button type="submit" class="button button-primary" name="wsqa6_save" value="1">Save</button></p>
					</div>

					<div class="wsqa6-panel">
						<div style="display:flex; align-items:center; justify-content:space-between;">
							<h2>Available links</h2>
							<button class="button button-secondary" id="wsqa6-scan" type="button">Scan Now</button>
						</div>
						<div id="wsqa6-catalog">
							<?php if (!empty($catalog)): ?>
								<?php
								$groups = [];
								foreach ($catalog as $id => $raw) {
									if (!is_array($raw)) continue;
									$it = self::sanitize_item($raw);
									if (!$it) continue;

									$p = !empty($it['parent']) ? $it['parent'] : 'Other';
									if (!isset($groups[$p])) $groups[$p] = [];
									$groups[$p][$id] = $it;
								}
								ksort($groups);

								foreach ($groups as $parent => $items) :
								?>
								<details class="wsqa6-details">
									<summary><?php echo esc_html($parent); ?></summary>
									<div style="margin-top:10px;">
										<?php foreach ($items as $id => $it): ?>
											<label class="wsqa6-item">
												<input
													type="checkbox"
													name="wsqa6_pick[]"
													value="<?php echo esc_attr($id); ?>"
													<?php checked(in_array($id, $selected, true)); ?>
													data-parent="<?php echo esc_attr($it['parent']); ?>"
													data-label="<?php echo esc_attr($it['label']); ?>"
												/>
												<strong><?php echo esc_html($it['label']); ?></strong>
											</label>
										<?php endforeach; ?>
									</div>
								</details>
								<?php endforeach; ?>
							<?php endif; ?>
						</div>
					</div>

				</div>
			</form>
		</div>
		<?php
	}

	public static function handle_save() {
		if (!isset($_POST['wsqa6_save'])) return;

		check_admin_referer(self::NONCE_ACTION, '_wsqa6_nonce');

		$catalog = self::get_catalog(); // hardened
		$picked  = isset($_POST['wsqa6_pick']) ? (array) $_POST['wsqa6_pick'] : [];
		$picked  = array_values(array_filter(array_map('sanitize_text_field', $picked)));

		$order_raw = isset($_POST['wsqa6_order']) ? sanitize_text_field($_POST['wsqa6_order']) : '';
		$order = array_values(array_filter(explode(',', $order_raw)));

		$final = [];
		foreach ($order as $id) {
			if (in_array($id, $picked, true) && isset($catalog[$id]) && is_array($catalog[$id])) $final[] = $id;
		}
		foreach ($picked as $id) {
			if (!in_array($id, $final, true) && isset($catalog[$id]) && is_array($catalog[$id])) $final[] = $id;
		}

		update_user_meta(get_current_user_id(), self::META_SELECTED, $final);
		wp_safe_redirect(add_query_arg(['page'=>self::PAGE_SLUG,'updated'=>'1'], admin_url('options-general.php')));
		exit;
	}

	/**
	 * Build a robust catalog from WordPress registered admin menu arrays ($menu / $submenu).
	 */
	private static function build_wp_admin_menu_items() {
		if ( ! is_admin() ) return [];

		global $menu, $submenu;
		$out = [];

		if ( ! is_array( $menu ) ) return $out;

		foreach ( $menu as $m ) {
			if ( ! is_array( $m ) || empty( $m[2] ) ) continue;

			$parent_slug = (string) $m[2];
			$parent_cap  = isset( $m[1] ) ? (string) $m[1] : 'read';

			$parent_label = isset( $m[0] ) ? wp_strip_all_tags( (string) $m[0] ) : '';
			$parent_label = trim( preg_replace( '/\s+/', ' ', $parent_label ) );

			if ( in_array($parent_slug, ['separator1','separator2','separator-last'], true) ) continue;
			if ( $parent_label === '' ) continue;
			if ( ! current_user_can( $parent_cap ) ) continue;

			if ( isset( $submenu[ $parent_slug ] ) && is_array( $submenu[ $parent_slug ] ) ) {
				foreach ( $submenu[ $parent_slug ] as $sm ) {
					if ( ! is_array( $sm ) || empty( $sm[2] ) ) continue;

					$label = isset( $sm[0] ) ? wp_strip_all_tags( (string) $sm[0] ) : '';
					$label = trim( preg_replace( '/\s+/', ' ', $label ) );
					if ( $label === '' ) continue;

					$cap = isset( $sm[1] ) ? (string) $sm[1] : $parent_cap;
					if ( ! current_user_can( $cap ) ) continue;

					$url = self::normalize_admin_url( (string) $sm[2] );
					if ( ! $url ) continue;

					$out[] = self::make_item( $parent_label, $label, $url, 'Admin Menu', $cap );
				}
			}
		}

		$out = array_merge( $out, self::build_extra_admin_links() );
		return $out;
	}

	/**
	 * Extra links for plugin UIs that don't register in WP's left admin menu ($submenu).
	 */
	private static function build_extra_admin_links() {
		$out = [];

		// Elementor "Custom Code" uses CPT elementor_snippet.
		if ( post_type_exists( 'elementor_snippet' ) ) {
			$pto = get_post_type_object( 'elementor_snippet' );
			$cap = ( $pto && ! empty( $pto->cap->edit_posts ) ) ? $pto->cap->edit_posts : 'edit_posts';

			if ( current_user_can( $cap ) ) {
				$out[] = self::make_item(
					'Elementor',
					'Custom Code',
					self::normalize_admin_url( 'edit.php?post_type=elementor_snippet' ),
					'Elementor',
					$cap
				);
			}
		}

		// Elementor Templates CPT.
		if ( post_type_exists( 'elementor_library' ) ) {
			$pto = get_post_type_object( 'elementor_library' );
			$cap = ( $pto && ! empty( $pto->cap->edit_posts ) ) ? $pto->cap->edit_posts : 'edit_posts';
			if ( current_user_can( $cap ) ) {
				$out[] = self::make_item(
					'Elementor',
					'Templates',
					self::normalize_admin_url( 'edit.php?post_type=elementor_library' ),
					'Elementor',
					$cap
				);
			}
		}

		return $out;
	}

	/**
	 * Normalize an admin URL/slug to an absolute URL.
	 */
	private static function normalize_admin_url( $url ) {
		$url = trim( (string) $url );
		if ( $url === '' ) return '';
		if ( $url === '#' ) return '';
		if ( stripos( $url, 'javascript:' ) === 0 ) return '';
		if ( preg_match( '#^https?://#i', $url ) ) return $url;
		return admin_url( ltrim( $url, '/' ) );
	}

	private static function make_item( $parent, $label, $url, $source, $cap = 'read' ) {
		$parent = sanitize_text_field( (string) $parent );
		$label  = sanitize_text_field( (string) $label );
		$url    = esc_url_raw( (string) $url );
		$source = sanitize_text_field( (string) $source );
		$cap    = sanitize_text_field( (string) $cap );

		$id = substr( md5( $source . '|' . $url . '|' . $label ), 0, 12 );

		return [
			'id'     => $id,
			'parent' => $parent ?: 'Other',
			'label'  => $label ?: $url,
			'url'    => $url,
			'source' => $source,
			'cap'    => $cap ?: 'read',
		];
	}

	/**
	 * Merge posted items (from JS scanners) with server-side WP menu items, then save.
	 */
	private static function build_merged_catalog_from_request( $items ) {
		$catalog = [];

		foreach ( self::build_wp_admin_menu_items() as $it ) {
			if ( empty( $it['id'] ) ) continue;
			$catalog[ $it['id'] ] = $it;
		}

		if ( is_array( $items ) ) {
			foreach ( $items as $it ) {
				if ( ! is_array( $it ) ) continue;

				$parent = isset( $it['parent'] ) ? sanitize_text_field( (string) $it['parent'] ) : 'Other';
				$label  = isset( $it['label'] ) ? sanitize_text_field( (string) $it['label'] ) : '';
				$url    = isset( $it['url'] ) ? self::normalize_admin_url( (string) $it['url'] ) : '';
				$source = isset( $it['source'] ) ? sanitize_text_field( (string) $it['source'] ) : 'Scan';
				$cap    = isset( $it['cap'] ) ? sanitize_text_field( (string) $it['cap'] ) : 'read';

				if ( $label === '' || $url === '' ) continue;

				$id = substr( md5( $source . '|' . $url . '|' . $label ), 0, 12 );

				if ( ! isset( $catalog[ $id ] ) ) {
					$catalog[ $id ] = [
						'id'     => $id,
						'parent' => $parent ?: 'Other',
						'label'  => $label,
						'url'    => esc_url_raw( $url ),
						'source' => $source,
						'cap'    => $cap ?: 'read',
					];
				}
			}
		}

		return $catalog;
	}

	public static function ajax_scan_save() {
		check_ajax_referer(self::NONCE_ACTION);

		$items = [];
		if ( isset($_POST['items_json']) ) {
			$decoded = json_decode(wp_unslash($_POST['items_json']), true);
			if ( is_array($decoded) ) {
				$items = $decoded;
			}
		}

		$catalog = self::build_merged_catalog_from_request( $items );

		// Force-add extra links every time
		foreach ( self::build_extra_admin_links() as $it ) {
			if ( is_array($it) && !empty($it['id']) ) {
				$catalog[ $it['id'] ] = $it;
			}
		}

		// Final sanitize before saving (prevents corrupt meta from ever being stored)
		$catalog = self::sanitize_catalog($catalog);

		update_user_meta(get_current_user_id(), self::META_CATALOG, $catalog);
		wp_send_json_success();
	}

	/* =========================
	   HARDENING (prevents fatals)
	========================= */

	private static function sanitize_item($it) {
		if (!is_array($it)) return null;

		$id     = isset($it['id']) ? sanitize_text_field((string)$it['id']) : '';
		$parent = isset($it['parent']) ? sanitize_text_field((string)$it['parent']) : 'Other';
		$label  = isset($it['label']) ? sanitize_text_field((string)$it['label']) : '';
		$url    = isset($it['url']) ? (string)$it['url'] : '';
		$source = isset($it['source']) ? sanitize_text_field((string)$it['source']) : '';
		$cap    = isset($it['cap']) ? sanitize_text_field((string)$it['cap']) : 'read';

		$url = self::normalize_admin_url($url);

		if ($id === '' || $label === '' || $url === '') return null;

		return [
			'id'     => $id,
			'parent' => $parent !== '' ? $parent : 'Other',
			'label'  => $label,
			'url'    => $url,
			'source' => $source,
			'cap'    => $cap !== '' ? $cap : 'read',
		];
	}

	private static function sanitize_catalog($raw) {
		// Handle JSON-string meta from older versions
		if (is_string($raw)) {
			$maybe = json_decode($raw, true);
			if (is_array($maybe)) $raw = $maybe;
		}
		if (!is_array($raw)) return [];

		$clean = [];
		foreach ($raw as $key => $it) {
			if (!is_array($it)) continue;
			$san = self::sanitize_item($it);
			if (!$san) continue;
			$clean[$san['id']] = $san;
		}
		return $clean;
	}

	private static function get_catalog() {
		$raw = get_user_meta(get_current_user_id(), self::META_CATALOG, true);
		return self::sanitize_catalog($raw);
	}

	private static function get_selected() {
		$raw = get_user_meta(get_current_user_id(), self::META_SELECTED, true);

		if (is_string($raw)) {
			$maybe = json_decode($raw, true);
			if (is_array($maybe)) $raw = $maybe;
		}
		if (!is_array($raw)) return [];

		$out = [];
		foreach ($raw as $v) {
			$v = sanitize_text_field((string)$v);
			if ($v !== '') $out[] = $v;
		}
		return $out;
	}
}

WSQA_Dashboard_Only_V6::init();
				
			

Huge thanks to Imran Siddiq - Web Squadron for architecting this tutorial!

❓FAQS: 

🛠️ Not natively with granular control. However, by deploying a clean code snippet via the Code Snippets dashboard, you can instantly render an adaptive shortcuts box that pulls in any nested submenu link.

💎 No premium overhead required. This exact system runs beautifully using a free, optimized custom code string executed through the standard Code Snippets framework.

🚀 Yes, absolutely. The scan engine maps out the entire underlying menu layout tree of your active installation, allowing you to pin nested items like specific template grids effortlessly.

⏱️ Simply navigate back to your Quick Access control window and hit “Scan Now.” This instantly refreshes the underlying paths to match the updated plugin architecture.

🔐 Yes. Because it integrates natively with WordPress core widgets, you can quickly show or hide the entire panel through the built-in Screen Options panel at the top of the page.

Picture of Andrea Morgado
Andrea Morgado
She’s a strategist at heart and a compulsory problem-solver who turned “helping brands grow” into a long-term career. As Marketing Lead at Code Snippets, she spends her days shaping stories, building visibility, and translating complex ideas into language humans can understand.. without buzzwords, fluff, or unnecessary SEO filler words. With 15 years of experience across branding, design, web design, and digital marketing, she believes in long-term thinking, clear communication, and doing the work properly before dropping it on LinkedIn. Away from the screen, she’s powered by curiosity, creativity, and a suspiciously reliable ability to spot what’s broken, confusing, or missing, and quietly fix it before anyone else notices.
Share this Post on Social
Facebook
Twitter
LinkedIn
Email

Table of Contents

Crocoblock 8th Birthday Sale

 Celebrate Crocoblock’s 8th Birthday with up to 35% off. Discover how pairing Crocoblock’s dynamic tools with Code Snippets Pro creates the ultimate developer stack

The Code Snippets Pro Affiliate Program

Turn Your Referrals into Revenue.

Love using Code Snippets? Share the “Pro Way” with your audience and earn a 30% lifetime commission on every sale. It’s fast to join, easy to track, and built for your long-term success.