Articles of php

How do you remove plugin edit option?

I would like to remove the edit option for all plugins on a wordpress site. Is there a hook/filter for doing this? It would be preferred to do it from the theme’s functions file, rather than try to disable it within each plugin. Ideally, it could be removed for users without admin privileges, but that […]

Stumped – Ajax Response Returns 0

I can’t seem to figure it out. No matter what I do, the ajax call keeps giving a 0 response. I’ve tested my PHP funtion and it works fine but whenever I call it through ajax I receive nothing (only a 0 response). Any help/suggestions is much appreciated. add_action(‘wp_ajax_get_ldapattr’, ‘get_ldap_attr’); add_action(‘wp_ajax_nopriv_get_ldapattr’, ‘get_ldap_attr’); function get_ldap_attr() { […]

How to get a list of term names of the custom post type im currently on in single.php

Ok so I have a custom post type of “Products” and a custom taxonomy of “Types”. Now in the types taxonomy I have dozens of categories and sub categories assigned to custom post types. Custom Post Type Item: Blue Car Categories assigned to car: Honda > Accord > LX So what I am trying to […]

Remove css styles from specific page

I need to remove all theme (both child and parent) css styles from a singular page using functions.php in a child theme. Here’s what I’m currently adding to the child’s functions.php // import parent and child theme css function theme_enqueue_styles() { wp_enqueue_style(‘parent-style’, get_template_directory_uri() . ‘/style.css’); wp_enqueue_style(‘child-style’, get_stylesheet_directory_uri() . ‘/style.css’, array($parent_style));} // remove the parent & […]

Place page title in header?

Normally, in WordPress, the page title appears in the content area. I’d like to have the page title appear in the header area. It looks like to do that, I’d have to remove it from its current location in the content-page.php and place it in header.php. But content-page.php is called from page.php, which calls the […]

Duplicate domain database to local – How?

I’ve noticed that my process is rather slow and i’d like to speed it up. I want to be able to duplicate my database from my domain which is blueharlequin.com and work locally thus speeding up the process. The reason I want to do that is because our website has specific loops that I cannot […]

Allow only 1 taxonomy per custom post type

This question already has an answer here: WordPress taxonomy radio buttons 3 answers

Must Use Plugin Causing Query Error

I created an MU Plugin which will only display the posts from certain tags in the loop like this: function custom_tags( $query ) { $query->set( ‘tag’, array( ‘custom’, ‘general’ ) ); } add_action( ‘pre_get_posts’, ‘custom_tags’ ); It works fine when I remove the array and only check for 1 tag, but how do I get […]

How to get subscription key or id using Woocommerce Subscriptions

I need to get the subscription key of a particular subscription to pass into a custom function. I have referenced the documentation where it shows how to get the key, but I have failed to integrate this into my code. So what my code does is, when a renewal is triggered, I hook into processed_subscription_payment […]

How to get to a specific position in wp_query?

Background: I’m trying to display images in a slideshow, and I want to select those pictures randomly from the website’s media. The image has a custom field in order to be selected for being the slideshow. I was able to figure all of that out, and I used a wp_query to find all of the […]