Use wordpress plugin in codeigniter

It is possible but probably not worth it. what you will need to do is bootstrap wordpress by including the wp-load.php file located at the root of the wordpress directory structure. The problem is that wordpress is still far from having a clean organized code which is globals free so while it is possible in … Read more

Revoke Access to certain user roles and admin pages

You can do this several ways, it just depends on how specific you want to get. Like do you need to disable for only one user with the ID of 21 or was that just an example? And are you trying to disable several pages or just a couple? Example 1: You can do this … Read more

How to check if a taxonomy not exists in a plugin

You will either need to do two things Check for an empty array AND a WP_Error object Check if the taxonomy exists (which get_categories() and get_terms() already does) before your execute your code and still check for an empty array FEW NOTES TO CONSIDER get_categories() uses get_terms(), you you could use get_terms() You do not … Read more

get_users meta_query: REGEXP not working for matching new lines

I found the problem and also fixed a bug in the regex. Final code: ‘meta_query’ => array( array( ‘key’ => ‘my_meta_field’, ‘value’ => “(^|\n|\r\n)99999($|\n|\r\n)”, ‘compare’ => ‘REGEXP’, ), ), The problem here was WordPress was adding extra backslashes on the special characters. By wrapping the expression in double quotes, this problem was solved. Also added … Read more

How to correctly add Javascript to this PHP ‘Page Not Found’ Page?

Problem The Short Version The problem isn’t how you’re using those scripts or where you’re placing them – it’s how the authors of those scripts wrote them. The Long Version Your “superfish” script which controls the functionality of your navigation menu is throwing errors because $.browser is undefined. While $.browser was deprecated more than 3 … Read more

pagination on data fetched using SQL query

<?php global $wpdb; // QUERY HERE TO COUNT TOTAL RECORDS FOR PAGINATION $total = $wpdb->get_var(“SELECT COUNT(*) FROM (SELECT * FROM muslim LIMIT 0,431) AS a”); $post_per_page = 10; $page = isset( $_GET[‘cpage’] ) ? abs( (int) $_GET[‘cpage’] ) : 1; $offset = ( $page * $post_per_page ) – $post_per_page; // QUERY HERE TO GET OUR … Read more

Only first shortcode gets executed

As indicated in the comments this code has nothing to do with shortcodes in the WordPress sense, but it is easy to see why it will never evaluate more than one pattern. preg_match returns true if there is at least one instance of the needle found in the haystack. So, no matter how many “shortcodes” … Read more