WordPress Custom post type require my file

I am building a plugin that will create a bunch of custom types of posts. The plugin will connect with an external API for different functions. For that, the settings page requires the API login form. All I want is in the admin area, when they will click the custom types pages to be required by the same api login form. Where should I place the expression

<?php require('api_login.php'); ?>

for the custom type pages? Is there a way to make it in the functions? Please be aware that the plugin will be given away and I will have no control on the other native files of WordPress platform.


No. The expression must be in every file where I need to call the login. Found that later.

Similar questions

how to require file from plugin directory of wordpress in theme page
I want to require_once an html file from plugin directory of wordpress in the custom page of wordpress i have tried but getting an error
Accessing $wpdb in new Wordpress PHP file, "require wp-load.php" NOT working
Alright, I've been pretty frustrated with accessing $wpdb in a new PHP file in WordPress. Now, I've gone through and read all the answers I could find on the situation, and they're all universal in saying that all I need to do is add wp-load.php at the top of my php file which uses $wpdb and it should work. I've done that... However, it still isn't...
Wordpress functionality plugin how to require file elsewhere on server?
I need to require_once() a file in my Wordpress functionality plugin which resides at home/me/vendor/ on the server. Wordpress of course is in www/html. Can someone direct me on how to define the path to the required file? Nothing I try seems to work. The first echo displays as expected (just a test). The second one does not so, for starters, I thi...
Require file in functions from theme directory using PHP
I am trying to dynamically get the facebook php sdk from my current themes folder. I am writing this in my functions.php, but all my attempts break the site. See my attempts below... Can any one help me understand why this does not work? Thank you very much.
Do we need to change our child function.php to require/include child dir files when we add an over-riding file.php into the child theme
With child themes we are supposed to leave parent functions.php in tact and extend it with the child functions.php. However parent functions.php typically define a whole load of include/requires which refer to files in the parent directory. Do we need to remember to over-ride these in our child function.php each time we create a child.php that over...
How do I require a file in a shortcode?
I have a shortcode that is working and displaying the problem is that it jumps to the top of the page. If I have any text or other shortcodes above it in the page editor they will be displayed below this one on the front end. There is about 259 lines of HTML in the shortcode_file.php file that is why I am doing it this way rather that just having i...

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.