Update PHP version 5.3 to 7.2 or first WP 4.7.11 to 4.9.8?

You should update both. ASAP. PHP 5.3 us not supported for over 3 years… So it may have security vulnerabilities… AFAIR there are no known vulnerabilities in WP 4.7.11, but… It’s an old version too… WP 4.7.11 should work fine on PHP 7.2 and WP 4.9.8 should also work on PHP 5.3 (but at least … Read more

Renaming post IDs – Okay to do?

Is it possible to change the post IDs within the wp_posts table without causing problems? No it is not. If you change a posts ID, you then have to go through and fix other things: the post meta key/value pairs would no longer have the correct ID All terms in taxonomies such as categories and … Read more

How to limit the content coming from wordpress shortcodes?

It’s better to 1st save the returned XML to a file and then loop back to unset. <?php $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => “http://www.cpac.ca/tip-podcast/jwplayer.xml”, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => “”, CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => “GET”, CURLOPT_HTTPHEADER => array( “cache-control: no-cache”, “postman-token: 28025ee8-1e82-ce60-f6ae-f401118baa1c” ), )); $response = … Read more

Way to display “Yesterday”, “Today”

It took me less than a minute of asking the googles (or bing, or duck) to find this answer: https://stackoverflow.com/questions/3454258/php-date-yesterday-today The accepted answer has the code you want to use (or will give you a starting point). (And this is not really a WordPress question…it’s a PHP question. PHP questions belong on the Stack Overflow … Read more

Autogenerate shortcodes from an array of strings

Your shortcode name (‘$name’ ) is invalid. If you want to use the variable, it should be add_shorcode( $name, …. Also, the function name is invalid. Since you want to make it “dynamic” (I’m assuming you want it to be {$name}_sc, then maybe you should use an anonymous function. What you have is somewhat unconventional … Read more

ajax_object is not defined when ajax calls the function

As Codex says, IMPORTANT! wp_localize_script() MUST be called after the script has been registered using wp_register_script() or wp_enqueue_script(). add_action( ‘init’, ‘my_script_enqueuer’ ); function my_script_enqueuer() { wp_enqueue_script( ‘jquery’ ); # before enqueue,if not register then register wp_enqueue_script( ‘add-order-front’ ); wp_localize_script( ‘add-order-front’, ‘ajax_object’, array( ‘ajax_url’ => admin_url( ‘admin-ajax.php’ ) ) ); }