How to deprecate a function used in a plugin?

In addition to the answer by @Welcher: There are some good “graveyard” examples in the core, where “functions come to die“. You could use them as guidelines, e.g. regarding the documentation. Here’s one such example for the permalink_link() under the wp-includes/deprecated.php /** * Print the permalink of the current post in the loop. * * … Read more

Setting $_SERVER[‘HTTPS’]=’on’ prevents access to wp-admin

Special thanks to user42826. According to the codex: If WordPress is hosted behind a reverse proxy that provides SSL, but is hosted itself without SSL, these options will initially send any requests into an infinite redirect loop. To avoid this, you may configure WordPress to recognize the HTTP_X_FORWARDED_PROTO header (assuming you have properly configured the … Read more

How to include checkbox in widget backend form?

First, on function widget: function widget( $args, $instance ) { extract( $args ); // Add this line $your_checkbox_var = $instance[ ‘your_checkbox_var’ ] ? ‘true’ : ‘false’; // Change ‘your_checkbox_var’ for your custom ID // … } On function update: function update( $new_instance, $old_instance ) { $instance = $old_instance; // Add this line $instance[ ‘your_checkbox_var’ ] … Read more

Query multiple custom post types in single loop

Just change the post_type bit to: ‘post_type’ => array(‘testimonial’, ‘other_post_type’, ‘another-post-type’), Assuming that taxonomy is valid across all 3 post types. Otherwise you’ll have to leave that out. Why? You can pass an array to post_type field.

How to return number of found rows from SELECT query

If you are merely trying to get a count, $wpdb->get_var(); along with using COUNT() in your sql will be better: ### Search for IP in database function postviews_get_ip($id, $ip) { global $post, $wpdb; $rowcount = $wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->wp_postviews_ips WHERE postid = $id AND ip = ‘$ip'”); return $rowcount; } postviews_get_ip($id, $_SERVER[‘REMOTE_ADDR’]); //both $id and … Read more

How do I use WP_query with multiple post IDs?

Please reference the Codex entry for post/page parameters for WP_Query(). The ‘p’ parameter takes a single post ID, as an integer. To pass an array of posts, you need to use ‘post__in’: $myarray = array(144, 246); $args = array( ‘post_type’ => ‘ai1ec_event’, ‘post__in’ => $myarray ); // The Query $the_query = new WP_Query( $args );

the_date() not working

See this special note about using the `the_date’ SPECIAL NOTE: When there are multiple posts on a page published under the SAME DAY, the_date() only displays the date for the first post (that is, the first instance of the_date()). To repeat the date for posts published under the same day, you should use the Template … Read more

Running WP Cron on multisite the right way

I think the best way is to use WP-CLI but you’d need to write a bash script to do this. Here is one that should do it for you: WP_PATH=”/path/to/wp” for SITE_URL in = $(wp site list –fields=domain,path,archived,deleted –format=csv –path=”$WP_PATH” | grep “,0,0$” | awk -F ‘,’ ‘{print $1 $2}’) do for EVENT_HOOK in $(wp … Read more

deneme bonusu veren sitelerbahis casinomakrobetceltabetpinbahispolobetpolobet girişpinbahis girişmakrobet girişpulibet girişmobilbahis girişkolaybet giriş