Question on how the framework works
-
I’ve written a couple plug-ins which is great. They aren’t on the plug-in site for WordPress — yet.
Anyway, I’m trying to understand how everything “under the hood” works.
I know when I created my plugin, I needed a plugin.php (for lack of better name) which has comments regarding the plugin. Also, I know this plugin.php is what WordPress uses to make my plugin work.
What I am not clear on is what WordPress knows and does not know after my plugin is activated.
Let me explain this a bit more.
Here is a crude but rough layout of all the functions of WordPress I used for my plugin.
if (!wp_next_scheduled(hook)) { wp_schedule_event(time, frequency, hook -> action); add_action(hook, function); register_deactivation_hook(file, function); register_activation_hook(file, function); add_action('init', function); add_action('admin_init', function); add_action('save_post', function); add_filter('template_include', function); add_action('wp_enqueue_scripts', function); add_action('widgets_init', function); if (is_admin()) { add_action('admin_enqueue_scripts', function); add_filter('manage_edit-CPTNAME_columns', function); add_filter('manage_edit-CPTNAME_sortable_columns', function); add_action('manage_posts_custom_column', function); add_filter( 'pre_get_posts', function); Plugin_Admin_Settings::intialize(); } }
So, here are my questions.
1. When my plugin is activated, WordPress “knows” about the events for wp_schedule despite the fact that the cron jobs on the box show nothing. Is this a “real cron” or has my provider hidden this from cPanel?
2. When I do an activate/deactivate in my plugin, my plugin can careless the next time it processes through plugin.php to show admin pages or webpage content. Is there an option I’m missing to tell WordPress not to event bother with this code “setup” in plugin.php if the plugin is activated?
3. So, I have code inside and outside of the “is_admin()” logic for functions such as “add_filter” and “add_action”. Does WordPress have to have this called EVERY time in plugin.php? Did I do something wrong design-wise by including these calls in my plugin.php?
The reason for all of these questions is because I’m concerned about performance and efficiency and I also want to follow best practices. I’m willing to refactor anything I’ve done. I’ve seen some boilerplate templates, but I don’t know if I agree with the layouts and designs.
Any advice and insight to how WordPress is working is greatly appreciated.
- The topic ‘Question on how the framework works’ is closed to new replies.