0
votes

Im developing plugin into wordpress. I click on my plugin in admin menu and in window appears user login. Under the user login I did new register account like hyperlink (with html tag a).

<a class="hyper" href="file.php">Register new account</a>

But this link redirects to localhost/my_project/wp-admin/file.php but this file doesnt exists there . My file is in localhost/my_project/wp-content/plugins/my_plugin/file.php. How can I appears this file into the same window as user login after clicking on hypertext ?

I try wp_redirect,header in href attribute but it is still redirect to wp-admin .

my code

<a class="hyper" href="<?php wp_redirect( home_url()."/wp-content/plugins/my_plugin/file.php"); ?>">Register new account</a>

Value of siteurl in wp_database is http protocol://localhost/my_project/

Thanks for answer

EDIT: I found that I dont need use plugin_url beccause its redirect to plugin url. I need load only page(file.php) into the same page. Its something which is related with slug_name (I mean $prefix_hook)

3

3 Answers

0
votes

so the path is ../wp-content/plugins/my_plugin/file.php.

 <a class="hyper" href="../wp-content/plugins/my_plugin/file.php">Register new account</a>
0
votes

You can try using plugins_url( 'file.php' , __FILE__ ) you can read more about the function here

*Edit:*Also you should probably check Determining Plugin and Content Directories

0
votes

do not use wp_redirect for links, it is intended to be a action within php code. If any output has started before the wp_redirect it will fail. And you need the exit() command afterwards. If you need a url that is a variable, use a function to set it.