[wp-trac] [WordPress Trac] #18504: Allow filtering of "Add New [Post Type]" URL on edit.php
WordPress Trac
wp-trac at lists.automattic.com
Wed Aug 24 00:54:56 UTC 2011
#18504: Allow filtering of "Add New [Post Type]" URL on edit.php
-----------------------------+-----------------------------
Reporter: tbuteler | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.2.1
Severity: trivial | Keywords:
-----------------------------+-----------------------------
I've recently attempted to use add_filter('admin_url','filter_function'),
only to discover that there are many URLs in the admin area that are not
passed through the admin_url() function. While there may be a good reason
for that to happen, I figured it wouldn't hurt to check the possibility of
changing one of them.
The one URL I haven't been able to find a workaround to is the "Add New
[Post Type]" button on the edit.php screen, on top the post table, which
also appears when editing an existing post. From what I gather, it is
generated in the following file/line
[http://core.trac.wordpress.org/browser/trunk/wp-admin/edit.php#L189] for
the first case, and on this one
[http://core.trac.wordpress.org/browser/trunk/wp-admin/edit-form-
advanced.php#L198] for the second case.
Fixing this, assuming it's possible without compromising a functionality
I'm not aware of, would be as simple as replacing this:
{{{
<a href="<?php echo $post_new_file ?>" ...
}}}
And this:
{{{
<a href="<?php echo esc_url( $post_new_file ) ?>" ...
}}}
With this:
{{{
<a href="<?php echo admin_url($post_new_file); ?>" ...
}}}
And this:
{{{
<a href="<?php echo esc_url( admin_url($post_new_file) ) ?>" ...
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18504>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list