profile_update hook does not fire from front-end
profile_update hook does not fire from front-end
profile_update hook does not fire from front-end
Let’s say your site’s address is example.com. When you want to redirect to example.com/page/subpage you should use site_url(‘/page/subpage’). I assume the WordPress address is http://127.0.0.1:8000. You have in your code site_url( ‘http://127.0.0.1:8000/?page_id=5’ ) and it will be converted to this address: http://127.0.0.1:8000http://127.0.0.1:8000/?page_id=5. Try using this redirection: wp_safe_redirect( site_url( ‘/?page_id=5′ ) ); Second issue, if you’ll … Read more
Have you already used this image in a different post? The post_parent may already be assigned to a different post ID from the one you are on. The code you have will only return images uploaded to this post first. I’ve seen a few regex type solutions to this problem, however I think PHPs DOMDocument … Read more
publish_post action callback not executed, why?
Yes, absolutely, it is possible. And here’s an example: Use an action and pass the post’s position in the loop to the action’s callback/function, and let the callback run the conditional and display the image if applicable. $position = 1; // start at 1 while ( have_posts() ) : the_post(); the_title( ‘<h3>’, ‘</h3>’ ); // … Read more
You could hook into template_redirect and execute a helper function: add_action( ‘template_redirect’, ‘wpse_75558_count’ ); function wpse_75558_count() { if ( is_singular() ) setPostViews( get_the_ID() ); } To display the post views, you have to use a later hook. I would recommend the_content: add_filter( ‘the_content’, ‘wpse_75558_show_count’ ); function wpse_75558_show_count( $content ) { $count = getPostViews( get_the_ID() ); … Read more
Perhaps you could push the variable contents to error log for later inspection? Like so, function addFilter($views) { // error_log is native php function to log stuff // print_r prints human-readable information about a variable, // print_r second parameter makes the function return result instead of echoing it error_log( print_r( $views, true ) ); return … Read more
You’re using the static class method call when supplying a callable/callback to add_action(): add_action( ‘wp_head’, array( ‘test_class’, ‘greeting_head’ ) ); So you should make the greeting_head() a static method in your test_class class. But you’d also need to make the greeting() a static method: class test_class { public static function greeting() { echo ‘Howdy! Test … Read more
I think you are headed down the right path, but I think that func_get_args() is only going to give you the arguments passed to that function. That is how I have always used it in the past. I took a different approach that I think might work. I found debug_backtrace() to be helpful in debugging … Read more
How do I remove an action hook inside a class that is called by another class?