• I am developing a plugin. I have an Add New button in one of my Admin panel page like below.

    View post on imgur.com

    I would like to redirect to https://127.0.0.1/wordpressplugin/wp-admin/admin.php?page=newAddress when click on it.

    I wrote below code for this

    echo '<div class="wrap"><h1 class="wp-heading-inline">Addresses</h1>
    		<a href="'.admin_url("admin.php?page=newAddress").'" class="page-title-action">Add New</a>';

    But this code is not redirecting to that link. What is the solution ?f

    How did it done here ?

    https://i.stack.imgur.com/3Jqhd.png

    Thanks.

    • This topic was modified 4 years, 3 months ago by abufoysal.
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    There is no useful filter we can hook to to alter the button HTML. Your best option is to add custom admin jQuery script. Once the page loads, your script can change the href attribute of the button.

    Generally speaking, you’re better off modifying the standard WP edit screen for your post type than trying to redirect to a completely custom screen. You can suppress unneeded edit screen elements by defining what your post type supports or doesn’t support. You can add custom meta boxes to provide UI elements not available from WP by default. There’s really no need for an entirely custom screen. You’re then working with how WP is supposed to work instead of fighting it.

Viewing 1 replies (of 1 total)
  • The topic ‘Add New Button in Admin Panel’ is closed to new replies.