update_post_meta doesnt update template

What’s the problem of this code? You incorrectly called get_page_by_path() whereby if you want to specify the post type (the third parameter), then you need to specify the second parameter as well which is the return type and defaults to OBJECT. So: // Wrong: Missing the return type (second parameter). // Or I mean, the … Read more

WordPress shortcode using WPB_GET_IP

See the accepted answer at ServerFault: […] if a request is chained through more than one proxy server, then each proxy should add the IP of the preceding one to the existing X-Forwarded-For header so that the entire chain is preserved. X-Forwarded-For: <client>, <proxy1>, <proxy2>, …

wp_schedule_event custom event time

I use the following code to run a task. this doesn’t require adding a cron schedule. function setup_my_action() { if (!wp_next_scheduled(‘my_action’)) { wp_schedule_single_event(time()+3600, ‘my_action’); } } function my_action() { // do something } add_action(‘init’,’setup_my_action’); add_action(‘my_action’, ‘my_action’);

Add function after the_content

The main issue in your code is caused by the call to zss_social_buttons() in your filter function: // In zss_insert_share_buttons(): $social_share_buttons = zss_social_buttons(); // NULL $content .= $social_share_buttons; And the problem there is that zss_social_buttons() is echoing the sharing links/buttons instead of returning them, so they’re not actually added to the $content variable. Instead, they’re … Read more

Shortcode not appearing when used as post content in wp_insert_post() or possibly, shortcode not being registered at all

You’re only registering the shortcode on activation. add_shortcode() is not persistent, and since shortcodes are parsed on output, the shortcode needs to be registered on every request. So you need to move add_shortcode() outside of the activation hook: function install_myplugin() { // … } function uninstall_myplugin() { // … } function myplugin_shortcode_reference() { // … … Read more