Searching Posts Programmatically in a WordPress Plugin

If I navigate to Posts -> All Posts in a WordPress install, there’s a Search Box in the upper right hand corner. Entering terms in this box and clicking the Search Posts button will perform a search. Does WordPress provide a hook, function, or other API that would allow me to programmatically perform the same (or a…

WordPress how to find where a shortcode comes from

Just use the Windows search bar in wp-content directory and search for companyName_apply_form. You should find the file where the shortcode is created. To add a shortcode in WordPress you normally use this syntax: ‘add_shortcode(“shortcode_name”, “function_name”)’ So with basic linux skills, you can find the function_name + file that define the shortcode_name grep “add_shortcode” * -r|grep submit_job_form ……

WordPress how to get current url woocommerce product

I am trying to get Woocommerce product permalink by given product name. I know I can get permalink by given product ID like this: $url = get_permalink( $product_id ); But I can not find any code to get it by product name. I tried this: $url = get_permalink( ‘title’ ); Or in the woocommerce template,…

WordPress Get ID of Current Category

Getting the ID of the current category in WordPress is actually quite simple. How can I retrieve slug of current taxonomy being viewed in taxonomy template? To further explain, lets say I am viewing category flowers so how can I retrieve slug of category flowers? We are going to use get_queried_object() to accomplish this task. The following…

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”])