Wednesday, February 26, 2014

"An error occurred in the upload..." (WordPress Media)

Seeing "An error occurred in the upload..." message when calling WP Media interface on the front?

I believe, that's a core problem, but here is a workaround that I am using quite often in my projects.

Admins won't have this bug, but regular users - will. Because we are on a page, which $post was not created by this regular user, so he does not have the editing capabilities... and Media needs them.

// Preserve the current Post
// (just in case, you may not need it)
$oldPost = $GLOBALS['post'];
// Make it a dummy
$GLOBALS['post'] = 0;

// For example, the editor, with "Media" button:
wp_editor($content, $editor_id, $settings);
// Or "Upload Avatar" code from the WPUA plugin
do_action( 'show_user_profile', $current_user );

// Restore
$GLOBALS['post'] = $oldPost;

// Be happy

Sunday, February 16, 2014

Visibility of Google Docs (Drive) in SERPs

I've been wondering how would it work if, instead of typing in a blog, I'd share Google Docs. There is a "Publish on the Web" option there. Would I still need a blog, or I can maintain a combination of Google Plus and Google Drive?

I do not have an answer yet, but here is a "discovery" I just made by checking the Google Docs visibility in search results. There is nothing surprising in what I saw, just a little fun :-)

Update:

I received this comment:
... they are not private as you suggest in your article, they are simply shared docs that violate G's TOS
Specifically, they are BH intermediary pages with the intention of passing PR via one of Google's own subdomains. ;(


  • Google publishes links to (probably) all people's docs.
  • All titles and descriptions are the same
This looks almost the same as it would look on your site with the Disallow instruction in the robots.txt file.

Almost - because Google substitutes the title and description with self-promotion.

and finally:
  • When you click on a link, it shows a "scary" message :-)