Tag Info

New answers tagged

1

The earliest safe hook to get post information is the template_redirect hook. All the hooks in question runs before Wordpress has setup postdata, so any post info are still unavailable at that point. The globals like $wp_query and $post will still contain no data, that is why your efforts returns nothing. EDIT Extra info as per comment by @TheDeadMedic ...


0

This can be achieved by using the admin_url filter: function add_new_post_url( $url, $path, $blog_id ) { if ( $path == "post-new.php" ) { $path = "post-new.php?param=value"; } return $path; } add_filter( 'admin_url', 'add_new_post_url', 10, 3 );


1

You want the has_action() function. add_action( 'category_promo_header', function () { echo 'hi there'; } ); if (has_action('category_promo_header')) { echo '<div>'; do_action('category_promo_header'); echo '</div>'; } Comment that add_action and you should see that nothing is printed at all.


0

You can use "save_post" action-hook Add the code below into functions.php and enchance with your comment_meta code. function update_comments_meta( $post_id ) { // Do whatever add/update_comment_meta code you need } add_action( 'save_post', 'update_comments_meta' ); UPDATE. As an example i've attach code below. It performs on post save/update ...


0

How is $_GET['post'] set ? And why are you checking it? It could be that you're adding the save_post call too late. Try: function foo() { die('Saving post'); } function foo2() { if( isset($_GET['post']) ) foo(); } add_action( 'save_post', 'foo2' );


0

Did you try hooking a bit later? add_action('template_redirect' , 'prevent_profile_access'); References: https://codex.wordpress.org/Plugin_API/Action_Reference https://codex.wordpress.org/Plugin_API/Action_Reference/template_redirect


1

No, you cannot do that, unfortunately, because get_header( $name ) doesn't have a filter for the $name (it only passes the name with the action call). However, if you are willing to modify the header.php file for each site with something like this right at the beginning of the file: <?php if ( apply_filters( 'load_custom_header', false ) ) { ...


1

In the wp-includes/class-wp-xmlrpc-server.php file Inside the function mw_newPost() after these lines: $post_title = isset( $content_struct['title'] ) ? $content_struct['title'] : null; $post_content = isset( $content_struct['description'] ) ? $content_struct['description'] : null; Add: global $wpdb; $some_post = $wpdb->get_row(" SELECT ID ...


2

juste before testing login and password, you have the action wp_authenticate: https://codex.wordpress.org/Plugin_API/Action_Reference/wp_authenticate juste after test and only if logging is successful, the action wp_login: https://codex.wordpress.org/Plugin_API/Action_Reference/wp_login and after logging, you can also modify the URL with the filter ...



Top 50 recent answers are included