Adding a widget programmatically

Because your code is just like prototype, it doesn’t display anything. That’s why your are not seeing anything in dashboard. /** * Adds Foo_Widget widget. */ class Foo_Widget extends WP_Widget { /** * Register widget with WordPress. */ function __construct() { parent::__construct( ‘foo_widget’, // Base ID esc_html__( ‘Widget Title’, ‘text_domain’ ), // Name array( ‘description’ … Read more

Insert query inserts 2 entries, should insert 1

Sounds like browser prefetching, see WordPress core tickets #12603, #14382, and #20192. Basically, sometimes some browsers see what the next post is, and decide to go ahead and load it while you are reading this one. So when you go to the next post it loads immediately, instead of you having to wait. The downside, … Read more

Is there a limit on the size of a WP page?

Some of your user pictures are 30K characters long when encoded. Have you heard of URL length limit? See What is the maximum length of a URL?. Also I believe there are some limits were put by browser manufacturers in spite of HTML 4-5 specifications does not put any limits on attribute value length (AFAIK).

Way to force media uploader use custom image size

When calling add_filter( ‘image_size_names_choose’, ‘custom_image_sizes_choose’ ); use your investigative skills to see how it would be best to call an if(thisweretrue) add_filter( ‘image_size_names_choose’, ‘custom_image_sizes_choose’ ); since I don’t know exactly what your specific situation is. I actually was able to use your solution for setting up the custom sizes to help out with what I … Read more

Passing .pem and .key files in cURL doesn’t work in WordPress

Based on @Mamaduka comment; the following changes resolve it: Use plugin_dir_path() to get the filesystem directory path: $certfile = plugin_dir_path(__FILE__) . ‘/clientcert.pem’; $keyfile = plugin_dir_path(__FILE__) . ‘/clientkey.key’; Then remove getcwd(). If you want to use it in your theme use TEMPLATEPATH I also want to mention that using the following paths previously did not work: … Read more

WordPress Capabilities: edit_user vs edit_users

I found a few references to edit_user as a capability, one of which is this: // Allow user to edit itself if ( ‘edit_user’ == $cap && isset( $args[0] ) && $user_id == $args[0] ) break; http://core.trac.wordpress.org/browser/tags/3.5.2/wp-includes/capabilities.php#L1005 I believe the comment in that block of code answers this question. Per @PatJ, it looks like map_meta_cap … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)