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…

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…

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 pip freeze In most linux systems, you can pipe this to grep to find the row for the particular package you’re interested in: $ pip freeze | grep lxml lxml==2.3 For an individual module, you can try the __version__ attribute,…

WordPress backup database with wp command

#!/bin/sh /usr/local/bin/wp db –path=/var/www/websites/wp – | gzip > /var/www/backups/db_backup-$(date +%Y-%m-%d-%H%M%S).sql.gz & tar –create –gzip –absolute-names –file=/var/www/backups/wp_backup-$(date +%Y-%m-%d-%H%M%S).tar.gz –exclude=*.tar.gz /var/www/websites/wp #!/bin/sh wp db export – | gzip > ./db_backup-$(date +%Y-%m-%d-%H%M%S).sql.gz #!/bin/sh tar –create –gzip –verbose –absolute-names –file=./wp_backup-$(date +%Y-%m-%d-%H%M%S).tar.gz –exclude=*.tar.gz /var/www/websites/wp  

WordPress create term programmatically with wp_insert_term

(array|WP_Error) wp_insert_term( $term, $taxonomy, $args = array() ); 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…

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. Example Convert from JSON to Python: import json # some JSON: x =  ‘{ “name”:”John”, “age”:30, “city”:”New York”}’ # parse x: y = json.loads(x) # the result is a Python dictionary: print(y[“age”])  

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. Example Convert from Python to JSON: import json # a Python object (dict): x = {   “name”: “John”,   “age”: 30,   “city”: “New York” } # convert into JSON: y = json.dumps(x) # the result is a JSON string: print(y)  

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…

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 ls -larth `which python`* -rwxr-xr-x 2 root root 4.3M Nov 17 19:23 /usr/bin/python3.5 -rwxr-xr-x 1 root root 3.4M Nov 19 09:35 /usr/bin/python2.7 lrwxrwxrwx 1 root root 24 Feb 5 09:36…

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? Say you have an ACF group with 3 fields each of a different type description (type Text) image (type Image) categories (type Taxonomy) prepare a basic post $my_post = array( ‘post_title’ => ‘My post’, ‘post_content’ => ‘This is my post.’, ‘post_status’ =>…