Wordpress nerede "admin_url"

1 Cevap php

() herhangi bir fikir verir admin_url - temelde değerini değiştirmek gerekir?

1 Cevap

Bu fonksiyon, wp-includes/link-template.php 'de tanımlandığı ve bir filtre sunar:

/**
 * Retrieve the url to the admin area.
 *
 * @package WordPress
 * @since 2.6.0
 *
 * @param string $path Optional path relative to the admin url
 * @return string Admin url link with optional path appended
*/
function admin_url($path = '') {
    $url = site_url('wp-admin/', 'admin');

    if ( !empty($path) && is_string($path) && strpos($path, '..') === false )
        $url .= ltrim($path, '/');

    return apply_filters('admin_url', $url, $path);
}

Yani sizin temalar kendi bir filtre işlevi ile çıkışını kontrol functions.php yapabilirsiniz:

add_filter('admin_url', 'my_new_admin_url');

function my_new_admin_url()
{
    // Insert the new URL here:
    return 'http://example.org/boss/';
}

Şimdi tüm eklenti yazarları bu işlevi değil, bir sabit kodlanmış yolunu kullanmak umuyoruz ... :)

Addendum

. Senin htaccess bu satırı ekleyin:

Redirect permanent /wp-admin/ http://example.org/new_url/