Seeking clarification on page request life-cycle
To see both when an action is fired and when a file is included, take a look here: http://wp-roadmap.com/demo/ Note that it only covers things inside WP Core, along with the default theme.
To see both when an action is fired and when a file is included, take a look here: http://wp-roadmap.com/demo/ Note that it only covers things inside WP Core, along with the default theme.
You cannot check if an action will be called before that happens. Even if there were already callbacks attached to the action there would be no guarantee the matching do_action() will be used. In your case, test with is_plugin_active(): if ( is_plugin_active( ‘wordpress-seo/wp-seo.php’ ) ) { // do something } As @Barry Carlyon mentions in … Read more
You generally use add_filter before displaying information. For your case you can use add_action(‘publish_post’, ‘your_function’) and then you intercept $_POST values. The content of the WYSIWYG editor is available through $_POST[‘content’]. The hook is of type publish_{post_type} btw. You should change accordingly. Example: function wpse_89292_save_my_post() { print_r( $_POST[‘content’] ); # will display contents of the … Read more
I finally found a way to add more lines to the Sites > Infos table : It’s a little bit ugly, but it works. I simply use the action admin_footer to add a bunch of HTML code at the end of the page, and then use jQuery to move it to the right place. add_action(‘admin_footer’, … Read more
This is the filter: “plugin_install_action_links”. You can find this in /wp-admin/includes/class-wp-plugin-install-list-table.php (currently) at line 434: $action_links = apply_filters( ‘plugin_install_action_links’, $action_links, $plugin ); Use it like: add_filter( ‘plugin_install_action_links’, ‘my_custom_links’, 10, 2 ); function my_custom_links( $action_links, $plugin ){ $action_links[] = ‘<a href=””>……</a>’; return $action_links; }
The delete_attachment action is fired when wp_delete_attachment() function is called to delete an item in the media library.
I believe you are looking for $params = apply_filters( ‘dynamic_sidebar_params’, $params ); (look here: https://github.com/WordPress/WordPress/blob/master/wp-includes/widgets.php#L706). Now this filter will evaluate both in front end and back end. so to answer your question, you could wrap your filter in a if( is_admin() ){ // Do icons } check. Better yet, you could define this at registration … Read more
Modify your form to include: <form action=”<?php echo admin_url(‘admin-post.php’); ?>” method=”post”> <input type=”hidden” name=”action” value=”volunteer”> … </form> and add an action to run your function: add_action( ‘admin_post_volunteer’, ‘send_contact_to_civicrm’ ); add_action( ‘admin_post_nopriv_volunteer’, ‘send_contact_to_civicrm’ ); function send_contact_to_civicrm() { // stuff here }
HTML generated by the_post_thumbnail() & get_the_post_thumbnail() can be altered using the post_thumbnail_html filter. This works even when there is no post thumbnail. Example: /** * Filters the post thumbnail HTML. * * @since 2.9.0 * * @param string $html The post thumbnail HTML. * @param int $post_id The post ID. * @param string $post_thumbnail_id The … Read more
Why it is added in the footer: This is the expected behaviour. Since you have enqueued the style within your Shortcode hook function, by the time it executes, WordPress is already done generating the <head> section of your page, since WordPress will only execute your shortcode function once it has found the shortcode in your … Read more