Comment by janh on WP_Query: apply an SQL function to meta fileld value
You'll have to use filters to change the SQL that WP_Query generates - are you OK with that or does that fall under manual SQL?
View ArticleComment by janh on Different favicon on different pages
Why not? Just set the appropriate meta tags and see what the browser make of it.
View ArticleComment by janh on Change number of posts to show on Archive page (custom...
is_main_query will probably be what you're looking for. It's only true for the main query that WP will execute to find the post(s) that the request is asking for, but not for consecutive queries (as a...
View ArticleComment by janh on I am trying to modify a plugin and am adding Jquery, but...
}); appears to be double, leading to an error.
View ArticleComment by janh on Update products with curl (bash)
Look at what your browser actually sends when you update a post. At the very least, you'll need a nonce. However, depending on what you're trying to do, it might be easier to use wp-cli or write a php...
View ArticleComment by janh on How to implement AJAX within a class storing shortcode...
I guess you have add_shortcode somewhere? The problem is likely that your AJAX request is a completely different request from the request to the post/page where your shortcode got interpreted in the...
View ArticleComment by janh on Wordpress varnish pages printed twice
You're not using edge side includes (ESI), right? Otherwise, varnish shouldn't change the body at all, so I'd look very closely at the backend. Do you see two requests from varnish in the backend's...
View ArticleComment by janh on if statement with is_active_sidebar()
No, or rather: not necessarily. As long as either of those two sidebars are active (that is: contain widgets), the function will execute as if those lines weren't there at all. If both sidebars are...
View ArticleComment by janh on Can (slow) Internet speed get you a 500 server error?
Unlikely, but depends on the Browser, potential proxy servers etc. Look in your browser's developer tools at the request itself, especially at the headers & content of the response. Also look...
View ArticleComment by janh on shortcode is not rendered
Are you using the_content() in your template file? Do other shortcodes work?
View ArticleComment by janh on Forcing the Uninstall Hook to fail
You know, you could try it and find out AND share that knowledge with the community. -1.
View ArticleComment by janh on Update menu when saving settings
@Cyclonecode Sorry, I kinda completely trailed into my own thoughts that quickly diverged from what you had written. I've updated the answer and believe this should make more sense and not sound like...
View ArticleAnswer by janh for Ive got a term (get_term_by) but now I want to filter it...
Use WP_Query with Taxonomy Parameters. If you want posts that are in both categories, just add two conditions in tax_query (using an array for terms will get you posts that have at least one of those...
View ArticleAnswer by janh for Hiding the name of the user who is currently editing
The editing user is determined by wp_check_post_lock(), which in turn checks the _edit_lock postmeta field:function wp_check_post_lock( $post_id ) { if ( ! $post = get_post( $post_id ) ) { return...
View ArticleAnswer by janh for How can i hide post without thumbnails/featured images...
You can manipulate the main WP_Query just before it asks the database for posts. Looking for an existing _thumbnail_id meta field should suffice, so using the pre_get_posts filter, something like this...
View ArticleAnswer by janh for Echo custom admin field into a is_single()
$postids = get_option('codeable_posts_field');This will give you a string of comma separated post ids (according to your code, and if the user follows the instructions).array( $postids )will turn it...
View ArticleAnswer by janh for How should i sort “Last Update” Custom Column?
orderby will not contain the title of the column that is being clicked on, but its ID. Change your pre_get_posts filter to function my_organization_orderby( $query ) { if( ! is_admin() ) return;...
View ArticleAnswer by janh for Get Term names from WP Term Object
Sound like a strange thing to do, but I've seen stranger requirements, so I trust you have a good reason for that.$names = array();$slugs = array();$terms = get_terms(array('taxonomy' =>...
View ArticleAnswer by janh for Show all posts even if URL points to a single one
Testing with a standard install and twentysixteen, the problem lies within WP::parse_request. With your pre_get_posts action in place, simply removing that completely from the equation worked for...
View Article