Is there a way to make is_search() always return false
To is_search() allways return false you can use: add_action( ‘parse_query’, ‘search_even_empty’ ); function search_even_empty($query) { $query->is_search = false; }
To is_search() allways return false you can use: add_action( ‘parse_query’, ‘search_even_empty’ ); function search_even_empty($query) { $query->is_search = false; }
Theming Custom Plugin Page
I believe you’re using ajax refering the process_form.php. However the right way to access any ajax is through the wp-admin/admin-ajax.php. Pull all your code from process_form.php to a function (can be added on your main plugin file): function my_process_form() { //…code from process_form.php if ( ! $error ) { //your error boolean return wp_json_success(); //recommend … Read more
Your code is going to cause a fatal error as you have defined a function inside a loop, and therefore are redefining the function at every iteration thereafter. That is part of the problem. Take a look at cleaned up code: function pw_show_gallery_image_urls( $content ) { global $post; // Only do this on singular items … Read more
I might be wrong but I think wp_insert_user function doesn’t call wp_new_user_notification function. As your edit you need to call this function manually. As you are testing your plugin in a live site I presume the error reporting is turned off and hence you are not getting any error. if (empty($errors)) { $myplugin_newuser = wp_insert_user(array( … Read more
The error is that you’re trying to read $value[‘kk_youtube’] when there is no kk_youtube key in the array (undefined index). Rather than use isset, use get_post_meta with the third argument “single” true: $youtube_link = esc_attr( get_post_meta( $post->ID, ‘kk_youtube’, true ) ); This is effectively the same as doing: $value = get_post_custom( $post->ID ); if ( … Read more
How can I map a specific URL pattern to a plugin for processing
First of all, you have to make sure to register your public query vars with WordPress so it recognizes your rewrite rule vars. Add this code on your functions.php file: add_rewrite_rule(‘^(tips)/([^/]*)/([^/]*)/?’, ‘index.php?name=$matches[1]&id=$matches[2]&filter_id=$matches[3]’,’top’); add_filter(‘query_vars’, ‘foo_my_query_vars’); function foo_my_query_vars($vars){ $vars[] = ‘id’; $vars[] = ‘filter_id’; return $vars; } After that, enter on your Permalinks Settings page to flush … Read more
The hook to use here is admin_notices. However in register_activation_hook and register_deactivation_hook it shouldn’t be used because these function run when plugin activates and deactivates instance. A workaround it we use add_option when plugin activates and delete_option when plugin deactivates. Here is the code. Hopefully you will understand it properly <?php function my_admin_notice() { $screen … Read more
Its there you just need to click on “screen options” and make sure the checkbox is checked