Why this filter hook is not working when passing parameters?
try this $users = apply_filters(‘my_get_users’,$group);
try this $users = apply_filters(‘my_get_users’,$group);
Yes, of course: function my_mail() { add_filter(‘wp_mail_content_type’,’set_html_content_type’); wp_mail(); remove_filter( ‘wp_mail_content_type’, ‘set_html_content_type’ ); }
While login_form_top is a valid hook called by the wp_login_form function, wp_login_form is not used in wp-login.php, nor is that function used anywhere else that I can find. I greped my entire 3.5.1 install and found one reference to the function– the place where it is defined. It does not appear to actually be used … Read more
You can add as many page i.d’s and conditional tags as you like. You can use the_content filter in as many functions as you like as long as they use different function names. However, when you add HTML or text content after posts, you need to use code like this: add_filter( ‘the_content’, ‘your_content_filter’ ); function … Read more
Of course! I just had to set the $accepted_args parameter of add_filter() to 2. Like so: add_filter(‘posts_join’, ‘my_join’, 10, 2); function my_join($join, &$query) { echo $query->is_main_query() ? ‘y’ : ‘n’; return $join; }
Following code should do the trick. It takes the excerpt filter and returns the content instead. function wpse189347_excerpt( $excerpt ){ return get_the_content(); } add_filter( ‘the_excerpt’, ‘wpse189347_excerpt’, 10, 1 );
Based on your comments, it sounds like you just want a custom directory for your post type called client_gallery which is fairly straight-forward actually. The below just uses the upload_dir hook to achieve this: /** * Modify Upload Directory Based on Post Type * * @param Array $dir * * @return Array $dir */ function … Read more
add_filter(‘acf_the_content’, ‘replace_content’);
To alter the page ID before the query is run, hook the request filter. If you’re using pretty permalinks, pagename will be set, you can overwrite pagename with another page slug: function wpd_265903_request( $request ) { if( isset( $request[‘pagename’] ) ){ // any page $request[‘pagename’] = ‘some-other-slug’; } return $request; } add_filter(‘request’, ‘wpd_265903_request’); or you … Read more
WordPress allows it by default ( of course, plugins or theme can change that ). The code should be wrapped in <code></code>, like this: <code> global $var; echo $var; </code>