Wednesday, May 28, 2014

WordPress Tip: Export WooCommerce category list (SQL, CSV, Excel)

Run this SQL in phpMyAdmin, and then click Export link at the bottom to save as CSV for Excel or other format.

Note: tested only on one level of subcategories.

Gist revisions are welcome:

Thursday, March 20, 2014

SourceTree does not show submodules

(SourceTree is a nice Git client by Atlassian)

The Problem:

SourceTree loses track of Git submodules. The entire "submodules" sidebar section is invisible.

A "clue":

Click the "Terminal" toolbar icon and type
$ git submodule

You should see something like:
dbd34bd2657ef70f001c1d135e2e14adef7dcdb9 dbdump (heads/master)
No submodule mapping found in .gitmodules for path 'wp'

The first line is good. The second one is a "clue".
It says: "Git knows about a submodule that you defined earlier. However, it cannot find the path to it in your .gitmodules file!"

Apparently, the path to submodule is wrong, or absent.
Restore it.

...or if you do not need that submodule, issue the following command in the terminal window:
$ git rm --cached {your submodule path} 




Wednesday, March 19, 2014

Making a plugin: SVN, GitHub, PHPUnit and Travis-CI [Part 1]

This is my first experiment to publish an open-source code. It was quite a "challenge", after years of working exclusively for corporate clients and myself, to write something that can go to "the wild" :-))

WordPress version:
GitHub version:

Here is a shortened list of what's involved in making a public plugin and publish it on site:
  • Write a bullet-proof PHP code (mission impossible, but approach as close as you can)
  • Organize the code in a special way: names of the files, folders, special headers, screenshots, readme.txt and so on.
  • Place your plugin somewhere so that WordPress staff can check it out and approve. (Hint: GitHub is a good place for that)
  • Apply here: Note: the name of your plugin will become it's "slug" in the URL, so choose carefully!
  • Wait for the approval, and if you never used SVN before, take this time to learn the basics.
  • SVN-Commit your code once approved.
  • Wait for reviews and support request.............. :-)
  • Folders structure and on GitHub are not exactly the same as on
  • You can setup Travis-CI calling PHPUnit to test your code automatically. It's not an easy thing to setup - but highly recommended.
To Read:

I'll try to find time and write more details [Part 2,3,...] soon.

Sunday, March 16, 2014

WordPress: How to exclude plugin/theme files from Poedit catalog

► The Problem:

I use some third-party files in my WordPress plugin (or theme). When I run Poedit to built language files, it scans the main plugin folder and puts all text strings found in the .po file, including those from the third-party.

► The Solution?

Vaclav Slavik, the author of Poedit, placed a "wontfix" resolution on that, years ago. See and

So, there is no official solution to this.

► So, what to do?

Separate the 3rd party files from yours.

For example, put all your .php files into the "includes" folder, and 3rd party files - into the "vendor" folder. Then, in Poedit -> Catalog -> Properties -> Sources paths tab, instead of the "." (current folder), write "includes".

Poedit will scan only the "includes" and will ignore the "vendor" folder.

Saturday, March 15, 2014

List of Front and Admin WordPress Actions

Below is a list of core WordPress actions as of WP-3.9-beta1.
I obtained this list by printing the $tag parameter in both do_action() and do_action_ref_array() functions while running a front page and an admin page.
This list cannot be considered complete. Please use it for quick reference only.

Link to the spreadsheet on Google Drive:

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 :-)


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 :-)