WordPress how to find the source of a shortcode

I am working with wordpress and want to change the output of a shortcode that I wrote myself earlier. Because I forgot where I put it (bad organizing when I started with wp) I wondered whether there is a list of all shortcodes with their source files in the wp database somewhere?

You can use the following code to get a list of all registered shortcodes.

This will unfortunately not give you the source files of these shortcodes but a simple search through your plugins and themes should reveal the location of the shortcode.

How to send requests through a Proxy in Python 3 using Requests

In this blog post we will show you how to send your requests to a website using a proxy, and then we’ll show you how to send these requests through multiple IP addresses or proxies.

How to send requests through a Proxy in Python 3 using Requests

If you are using Python-Requests, you can send requests through a proxy by configuring the proxies argument. For example

We’ll show how to send a real request through a free proxy.

How to check version of python modules

I suggest using pip in place of easy_install. With pip, you can list all installed packages and their versions with

In most linux systems, you can pipe this to grep to find the row for the particular package you’re interested in:

For an individual module, you can try the __version__ attribute, however there are modules without it:

Lastly, as the commands in your question are prefixed with sudo, it appears you’re installing to the global python environment. Strongly advise to take look into python virtual environment managers, for example virtualenvwrapper

WordPress backup database with wp command


WordPress create term programmatically with wp_insert_term

A non-existent term is inserted in the following sequence: 1. The term is added to the term table, then related to the taxonomy. 2. If everything is correct, several actions are fired. 3. The term_id_filter is evaluated. 4. The term cache is cleaned. 5. Several more actions are fired. 6. An array is returned containing the term_id and term_taxonomy_id.

If the slug argument is not empty, then it is checked to see if the term is invalid. If it is not a valid, existing term, it is added and the term_id is given.

If the taxonomy is hierarchical, and the parent argument is not empty, the term is inserted and the term_id will be given.

Error handling: If $taxonomy does not exist or $term is empty, a WP_Error object will be returned.

If the term already exists on the same hierarchical level, or the term slug and name are not unique, a WP_Error object will be returned.

Examples code


Parse JSON – Convert from JSON to Python

If you have a JSON string, you can parse it by using the json.loads() method.

The result will be a Python dictionary.


Convert from JSON to Python:


Convert from Python to JSON

If you have a Python object, you can convert it into a JSON string by using the json.dumps() method.


Convert from Python to JSON:


Python Flask how to get parameters from a URL

In Flask, How do I extract parameters from a URL? How can I extract named parameters from a URL using flask and python?

When the user accesses this URL running on my flask app, I want the web service to be able to handle the parameters specified after the question mark:

Use request.args to get parsed contents of query string:

API URL will be as http://api.wpdemo.com/your-path?url=http://abc.com


Ubuntu 16 default python is almost python 3

Loads of solutions exist, but for changing the system default, alias is not the way to go.

$ update-alternatives –list python update-alternatives: error: no alternatives for python

So we have 2 – use these in update-alernatives


Create new post WordPress programmatically with custom meta fields

How can you create and insert new posts containing already filled Advanced Custom Fields programmatically into your database?

  1. Say you have an ACF group with 3 fields each of a different type
    • description (type Text)
    • image (type Image)
    • categories (type Taxonomy)
  2. prepare a basic post

  1. insert post and keep the created post id

  1. then update values of custom fields using the post id

… Or it can be done using the following code:

To enter a new post for a custom type


After inserting the post, a post id will be returned by the above function. Now if you want to enter any post meta information w.r.t this post then following code snippet can be used.