Topher
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Scheduled Posts Posting ImmediatelyThat’s great sleuthing, well done.
Forum: Developing with WordPress
In reply to: Save all posts automatically and execute functionRock on!
Forum: Networking WordPress
In reply to: Should I use a multisite for my business?Ok, that actually sounds like a great use case for multi-site. It’s certainly one viable option for multi-lingual, and using all the same theme (and probably plugins?) makes it sound quite reasonable.
Forum: Fixing WordPress
In reply to: Scheduled Posts Posting ImmediatelyI’m sorry, but I think I’m tapped out. In order to really figure it out I’d need my hands on the code and spend hours testing. π I’m not available, but if you know a dev they could probably do that for you.
Forum: Developing with WordPress
In reply to: Save all posts automatically and execute functionThe custom table shouldn’t matter, you can just adjust the query accordingly. If you look stuff up in phpMyAdmin it’ll show you the query it used.
The array I showed has post_ids as keys and dates as values. So you’d do something like
foreach ( $birth_dates_array as $post_id => #term ) { wp_set_post_terms( $post_id, $term, 'WhateverYourTaxonomyIs' ); }
Forum: Fixing WordPress
In reply to: Scheduled Posts Posting ImmediatelyThis ONLY happens when using the new block editor? Can you install the Classic Editor plugin and see if it does it there too? You might be onto a real bug here.
Forum: Developing with WordPress
In reply to: Save all posts automatically and execute functionFirst use a tool like phpMyAdmin to look at the postmeta table and find your custom fields. Is the date stored in plain text like 2022-10-01 or is serialized somehow? Plain text is preferred, but we could work with serialized.
Read about $wpdb: https://developer.wordpress.org/reference/classes/wpdb/
That makes it easy to send a custom query. Something like this:
$birth_dates = $wpdb->get_results( "SELECT post_id, meta_value FROM {$wpdb->postmeta} WHERE <code>meta_key</code> = 'YOURKEYNAME'" );
where YOURKEYNAME is whatever you called your birthdate field.
I don’t know for sure what the format will be coming back from that, but to be sure then you can do something like this:
$birth_dates_array = []; foreach ( $birth_dates as $birth_date ) { $birth_dates_array[ $birth_date->post_id ] = $birth_date->meta_value; // it might be this instead: // $birth_dates_array[ $birth_date['post_id'] ] = $birth_date['meta_value']; }
then you’ll have an array that looks like this:
[ 1,'2022-10-01', 2,'1971-07-17' ]
then it’s a plain array. Use
foreach
to loop over it and usewp_set_post_terms
(I misspoke aboutwp_create_term
above) to connect posts to terms.- This reply was modified 2 years, 2 months ago by Topher.
Forum: Fixing WordPress
In reply to: Scheduled Posts Posting ImmediatelyCheck this plugin out, it may help: https://wordpress.org/plugins/health-check/
Forum: Fixing WordPress
In reply to: All Categories not showing in Categories widgetMay the wind be ever at your back. Unless it’s hot out, and then a gentle breeze to the face.
Forum: Fixing WordPress
In reply to: All Categories not showing in Categories widgetWoo! I’m a genius and I didn’t even know it! Try this then, go to Settings β Permalinks and simply hit save, no changes. That MIGHT reset all of them at once. Maybe not, but it won’t HURT anything.
Forum: Developing with WordPress
In reply to: Save all posts automatically and execute functionThe taxonomy query is going to be WAY faster than a custom field query with math in it. Plus as a term you can do all sorts of other interesting things like make data maps of age groups, without every hitting the posts table.
Forum: Fixing WordPress
In reply to: All Categories not showing in Categories widgetI can’t see inside your admin area, but that is really odd. As a developer I can’t even think of how that’s possible. Maybe try taking one of those post OUT of that category, save, then put it back in and save again? Maybe only one side knows what category it’s in.
Forum: Fixing WordPress
In reply to: All Categories not showing in Categories widgetThe reason they’re not showing in the widget is that they THINK they have no posts. Why they think that, I don’t know, because I can obviously see lots of posts here: https://thatispricelessblog.com/category/fashion/
In the admin area, when looking at the term, it’ll show a 0 on the right. If you click the 0 it’ll take you to the admin list for posts. Does it show none, or does it shown what I see on the front end?
Forum: Fixing WordPress
In reply to: Scheduled Posts Posting ImmediatelyYep, I see it, and agree I shouldn’t. π
Forum: Fixing WordPress
In reply to: Scheduled Posts Posting ImmediatelyOut of the box WordPress won’t do that, which I’m sure you’ve experienced. That makes me think there’s a plugin or maybe even your theme that’s making that happen. Can you try it with all plugins turned off. and then a different theme?
It’s also POSSIBLE the date is messed up on our server. That seems really unlikely, but your host could check easily