Old post redirect
You don't need a plugin for this:
add_action('template_redirect', function () {
if (is_single() && get_post_type() === 'post') {
$modified = get_the_modified_time('U');
if ($modified && $modified < strtotime('-1 month')) {
wp_redirect(home_url('/'), 302);
exit;
}
}
}); Optinmonster pop not sensitive enough... what are the best alternatives?
Make your own, it's just a modal dialog and a lead form. Once you have those it's just a matter of writing logic for when and how it displays.
The best logic is your own logic for rules like that.
Has anyone successfully integrated ChatGPT's MCP with WordPress?
Check this out:
What really grinds my gears
3 scenarios where I see that happen often:
- Agency wants ownership and long-term dependency
- Corporate or high volume, business critical sites where updates need to be tested, approved, deployed and rolled back smoothly
- Startups that need/want things done the same day they request it
What grinds my gears is how much of the code makes no sense.
Still wrapping my head around custom post types and taxonomies with Wordpress.
ACF can add fields onto taxonomy terms, you can use that to add details to a term like am image and other stuff.
To actually display the term it'd be something like:
$terms = get_terms(['taxonomy' => 'your_taxonomy', 'hide_empty' => false]);
if (!empty($terms) && !is_wp_error($terms)) {
foreach ($terms as $term) {
$image_id = get_term_meta($term->term_id, 'image', true);
$image_url = $image_id ? wp_get_attachment_url($image_id) : '';
echo '<div class="term-item">';
if ($image_url) echo '<img src="' . esc_url($image_url) . '" alt="' . esc_attr($term->name) . '">';
echo '<h3>' . esc_html($term->name) . '</h3>';
echo '</div>';
}
} Canva newsletter to blog post - is there an easy way?
n8n or IFTTT
Can you assist me to build my website and set it up?
Like most things in business and life, there are plenty of people who will help.
They do it for a living, you can hire them.
[New Plugin] You Have No Idea How Many AI Bots Are Crawling Your WordPress Site
I'll stick with my CloudFlare report, no need for a plugin to be honest.
You must call 'the_content' function in the current template, in order for Elementor to work on this page.
The theme template needs to have two things for it to work:
the_post();
the_content(); Should I keep categories to a minimum when building a WordPress website.
No hard and fast rule, but I try to stick with a few unspoken rules:
- No tags, they're sloppy and never work out well
- Categories used for high level topics, should be 1 per post, not many, and never nested/sub categories
- Custom taxonomies should be used when you feel like you need to have two categories for one post, or need sun categories
Not necessarily rules for everyone, just rules I follow myself after building WP sites for a long time.
How do I edit Checkout page in WordPress / WooCommerce?
Dropping this into the functions.php file of an Astra child theme might work:
add_filter('woocommerce_checkout_fields', function ($fields) {
if (isset($fields['billing']['billing_phone'])) {
$fields['billing']['billing_phone']['required'] = true;
}
return $fields;
}, 20); Overwhelmed with Wordpress
Check out wsrv.nl, it's a hosted API for libvips that you can use to resize images on the fly:
That provides all kinds of great ways to optimize images, can be automated with hooks and filters or just done manually when needed. Either way it's faster than Figma, Sketch or any other image editor.
WordPress and Supabase Auth Integration
Supabase and tons of other SaaS platforms use Auth0 for handling the login. It's like Stripe but for authentication, and it has tons of stuff built-in you can leverage.
Auth0 could be configured as the WordPress login provider for authentication and it'd give you everything you're after. I also think it's free if you're under 15k active users per month.
I should clarify: supabase might probably use Auth0, can't actually verify on my phone.
Non-Profit Needs to show programs and link to registration on wordpress
Usually you can handoff a parameter to a third-party eCommerce provider like that, adding something like ?pid=abc123 or similar onto the URL.
WordPress theme with built-in plugins and reliable support for a medium-sized website
A few good reasons:
-
I've been hired a lot to fix the messes people make with it. I feel the pain of the business owners who are constantly dealing with issues and problems after every update, along with some major performance issues for any ship with a reasonable volume of sales.
-
It's a system that tries to be everything to everyone, and as a result you end up with a lot of unnecessary complexity and restriction. Jack of all trades, master of none. All that excess means many more places where things can break.
-
There is a LOT you can do with Stripe directly, and many of the cases I see for what people are trying to do can just be done so much simpler without it.
-
Knowledge and understanding of how to build things custom, with it comes some clarity on just how overly complex many of the sites using it out there are.
Advice on integrating custom core blocks into theme
Makes sense, for switching to core blocks: I tried it out myself, but it honestly was inferior all around. There was no real benefit, and a lot more time for really no gain.
Overwhelmed with Wordpress
Settings > Media is the standard approach: you set sizes for sm/md/lg images and they're auto-generated when an upload is made. That may be obvious and something you already know though.
For more advanced cases I use my own approach with wsrv.nl to auto crop to size.
Need help creating a reusable editable WordPress template for my project. Can offer wordpress paid plugins (elementor pro etc..)
What AI tools do you use for your daily work with WordPress and why?
ChatGPT - Used to use it for coding, now I rarely do since GPT 5 rolled out. Decent for image generation.
Claude - Best coding generation usually (as of 10/25)
Z.ai - Interesting option I've been poking around with
DeepSeek - Free pretty much, and good responses, but I don't end up using much.
Midjourney - Best creative image generation
Gemini - Best for creating realistic photos, and photos with text like diagrams or flowcharts
Ideogram - Good at image generation, without text
Ollama - UI for working with open-source AI models like Qwen3 and DeepSeek 3.1. Lately these have really closed the gap and are very close to the same quality. I use these often, but particularly for using AI in large scale stuff like generating hundreds of things, or for playing with RAG and fine-tuning. I do this on maxed out MacBook Pro M4+. It.cam be resource intensive.amd.may be slow for you depending on your setup.
Custom WordPress Development is Doomed
I do feel your pain, but at the same time I also do see a good amount of business owners out there that crave a simple system that just works.
Finding a way to build a great site faster and of much higher quality than the hack job page builders out there is what I've found works. Websites are standardized now to the point where there is no starting from scratch.
I have my own set of re-usable components. Not web components, just reusable bits of PHP/JS/SCSS code for standardized items. With AI code generation I think we have an opportunity to do a custom build much better compared to a page builder theme, and that may start to be noticed.
Attacks against WordPress from 400,000 to 120,000 in 30 days ??
Could be related to a CloudFlare update or improvement, or maybe WordFence was reporting a lot of false positives.
This coincides and is interesting if you look at the timeline:
https://blog.cloudflare.com/unauthorized-issuance-of-certificates-for-1-1-1-1/
Friendly reminder: Please upvote people who go out of their way to resolve your WordPress issues
I read once that people are something like 20x more likely to provide feedback/reviews on a negative experience than a positive one.
I answer hundreds of questions here, but don't get many up votes. That's OK though,. to be honest I don't do any of it for the upvotes really.
But for what it's worth, I upvoted your post! .
Need suggestion on creating a product catalog site without car
No way WooCommerce!!!
"I don't want to sell anything online."
Using WooCommerce here would be like buying an excavator to dig a single 1x1 foot hole. Use a shovel, unless you want to deal with parking and maintaining an excavator.
Create a custom post type with custom taxonomies for your criteria that needs to be filtered, and use ACF for managing product details as custom fields. Or don't and just generate a custom metabox with AI code then through z.ai or a similar AI tool.
Just because you CAN use heavyweight plugins does not mean you should.
add_action('init', function() {
register_post_type('auto_part', [
'labels' => ['name' => 'Auto Parts', 'singular_name' => 'Auto Part'],
'public' => true,
'supports' => ['title','editor'],
'show_in_rest' => true
]);
});
add_action('add_meta_boxes', function() {
add_meta_box('auto_part_details', 'Details', function($post) {
wp_nonce_field('auto_part_details_nonce','auto_part_details_nonce');
$sku = get_post_meta($post->ID,'sku',true);
$man = get_post_meta($post->ID,'manufacturer',true);
echo '<p><label>SKU<br><input type="text" name="sku" value="' . esc_attr($sku) . '" class="widefat"></label></p>';
echo '<p><label>Manufacturer<br><input type="text" name="manufacturer" value="' . esc_attr($man) . '" class="widefat"></label></p>';
}, 'auto_part', 'normal', 'default');
});
add_action('save_post_auto_part', function($post_id) {
if (!isset($_POST['auto_part_details_nonce']) || !wp_verify_nonce($_POST['auto_part_details_nonce'],'auto_part_details_nonce')) return;
if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
if (!current_user_can('edit_post', $post_id)) return;
if (isset($_POST['sku'])) update_post_meta($post_id,'sku',sanitize_text_field($_POST['sku']));
if (isset($_POST['manufacturer'])) update_post_meta($post_id,'manufacturer',sanitize_text_field($_POST['manufacturer']));
}); Finally stopped wasting time renaming media in WordPress
Enable Media Replace has done this really well for a decade or so:
https://wordpress.org/plugins/enable-media-replace/#description
Totally free, very reliable, and I hate to say it but it does all the same things I think.
Overwhelmed with Wordpress
Elementor and really all page builders are almost always overwhelming for clients when you hand them off. They offer an overwhelming amount of control, almost always way more than a designer or therapist would ever want.
ACF is different, it allows you to create simple web forms for managing the specific things they'll change most. My recommendation would be to try that, and use a good AI tool like Claude (or z.ai for a free one that's good) to generate code in a custom theme.
If you feel like you're spending most of your time figuring out how or where to change something in Elementor then this may be really refreshing.
It's also not complex, here's a demo from a recent site I did:
https://www.reconanalytics.com/team/jayne-testerman/
This is powered by a simple ACF field group that provides a Position and optional LinkedIn text fields. The theme template code is 70 lines in total.
Just took some screenshots of the CMS and the theme template code for you, to see:
https://drive.google.com/drive/folders/1ijjShkRA3fV6LOjH9RboDWCLyF4QX85k
Problems with UAE (header & footer)
It's very likely not the plugin, but something inside of the CSS and JS you've added to it. That said premium plugins do make the WP admin slow because they sometimes make frequent HTTP requests to check license status.
But for site speed results it has to be something in your JS, unless you have an uncached site.
Seeing how people learn WordPress in 2025
Has me thinking...
How much demand is there for a very good course with an experienced teacher?
Advice on integrating custom core blocks into theme
What's the real benefit of building core blocks over ACF?
In my experience the process with ACF is just so much less painful and way more intuitive. They also seem to break less to be honest, and are easier to fix when they do. My console is much clearer with ACF created blocks.
Is WordPress slowly turning into a SaaS platform, and what does that mean for plugin developers?
I've been an active part of the community for 17 years now. I think WordPress has followed a typical market lifecycle in many ways. The question is where are now, step 5 or 6?
1: Creation (2005-2008)
A few pioneers build something new. Motivations are idealistic. Focus is on innovation and proving the concept. Matt was quite visionary at this stage, a long with original core devs too.
2: Purity (2008-2013)
Early adopters arrive. The culture is tight, values are shared. Money isn't the only main driver yet for many.
3: Growth (2014-2020)
Demand surges. Capital and competition flood in. Standards start to form, winners emerge.
4: Saturation (2021 onward)
Too many players are chasing the same demand. Quality drops, margins shrink. Marketing outpaces substance.
5: Corruption (maybe now)
Shortcuts and exploitation replace innovation. Gatekeeping, manipulation, or monopolies appear. The culture that built it gets diluted or erased.
6: Decline or Renewal
The market either collapses or resets. A new wave splits off, restoring some of the early purity in a new form.
WordPress theme with built-in plugins and reliable support for a medium-sized website
Custom themes can be built with those specific features for content management, that's the only really way to get a precise and stable set of specific features. Which is a good long-term approach.
Responsive support could come from a web host like Kinsta, or maybe an agency selling a cheap maintenance ongoing support package. I do this really well for people, but it's specialized support not a $$$/mo generalized.
Good plugins can also be used to provide specific things you want:
- Rank Math for SEO is good,. stable, and separate from a theme
- Online stores can often be done with a post type and a little Stripe integration. Most folks here will recommend WooCommerce, I never do though to be honest.
- Team profiles can be done in a custom theme, I have a GitHub example from a smashing magazine article I wrote about it a while back. Still relevant though.
Getting a precise set of features and good responsive support is going to cost you some money. If you want it to be good.
How can I move text or image to the left of the page
Use a Custom HTML block like this:
<div class="alignright" style="width:40%">
<p>This text is aligned right.</p>
</div>
Or use two columns with the Columns block. You pick a layout (50/50, 70/30, etc) then drop content in each column. You can adjust width or spacing in the sidebar or by clicking and holding the edges of each column.
When using page builders, when do you use BEM classes vs utility classes?
You don't really use BEM with a page builder, but the general idea would be:
BEM when you create a custom block/widget/component/module/element or whatever else they call an isolated independent but of code that you re-use.
Utility classes when you're handling quick layout or spacing tweaks inside the builder like padding, margin, alignment, color, or backgrounds. Use them for small one-off visual adjustments, not reusable parts of the design.
"Copytrack" claiming their client owns image I purchased from Shutterstock
I'm not a lawyer, so don't take this as legal advice, but if you have a valid proof of purchase keep it and document it.
Then add a clear photo credit if you can as a caption, something like "Licensed under {license here} and purchased at Shutterstock".
And if you want to be extra cautious, send a DMCA counter notice:
Migrating WordPress Posts/Images from Virus Infected Website
Good advice here from bluesix, but I'll add one thing: you really need to understand the source of the problem. Usually it's in both the database and the file system, and the two work together to protect one another: remove the files and the DB regenerates them, and vice versa.
I haven't used it in a while but Sucuri used to have a service to remove all aspects of it for you for a flat fee. That's really the best option.
What do you use for ddos protection?
CloudFlare.
Set it, forget it (mostly), and benefit from a global hive mind of detecting threats and malicious attempts. DDoS is only one small concern, malicious attempts to gain access are worth the focus and CloudFlare is very good at mitigating them.
That said, a DDoS effect can happen when multiple bots try to index and scan a site at the same time. It's not meant as a denial of service, but the overload effect is the same. The best protection is to make sure your site is well cached, also where CloudFlare can help by serving pages directly from edge cache. You could have 100k people hit your site in a minute and not hit your server once.
Best page builder to learn
I would suggest Bricks over Elementor, it's faster and leaner. Although it is at times a little less intuitive. People also seem to really like the latest Divi builder, that may be worth a look.
When I first read the post my gut reaction was that learning just WordPress + Gutenberg would be your best option. Understanding WordPress at its core is really helpful, but Gutenberg is probably just going to scare you away.
If you're at all interested in learning a bit of coding, or you plan to build a theme at some point, ACF is worth learning. It's a different mind shift that can be really beneficial:
Page builder allows the CMS to control everything, content + design/presentation.
ACF allows the CMS to manage the underlying content, then a developer creates a template with that content to match a design.
Long-term it can be WAY easier to redesign a well built site that uses a custom ACF theme.
I'm Looking for advice for building this feature
WooCommerce.. no thanks.
Just did these for a custom laser engraved product builder, where you can upload and drag and drop place an SVG to be printed on it. No plugins, just Stripe features. Specifically a variably priced product.
The simplicity of this system compared to WooCommerce is absolutely INSANE. If you want a true custom product flow that scales it's the way to go. If you want a hacked together house of cards that you'll regret down the road, explore WooCommerce. These bitter words come from a whole lot of experience dealing with those messes for people, it's not pretty.
Plugin or Application that will allow a team to manage content outside of Wordpress.
I've actually done this with GitHub: writers/marketers make changes directly on github.com as markdown through the UI, and they're auto deployed to a site. The site then reads the markdown and serves the content as HTML. It works really well for simple content, and there's a whole log of content changes along with simple ways to rollback a change.
Another option would be what's already mentioned: create a custom role (Marketer) and then give them the ability to edit things in the frontend when they're logged-in. I did some interesting things like this a long time ago with the contenteditable HTML attribute. It was actually really interesting and worked quite well.
Any advice on how to turn page views and shares into followers/subscribers?
Think like you're selling a product, or are in the shoes of the people reading.
When was the last time you followed someone, or signed up for a newsletter? Why?
People will do it if they get something out of it, has to be a clear incentive.
Maybe post a big article in the newsletter, and a short teaser of it on the site. Mention the full thing is in the newsletter.
How do I design a main page with windows like these containing any new post I make?
Theming 101, look up "the loop".
Free Interactive map plug-in that doesn’t require a credit card on file
Leaflet JS is the way, can be done quite well with OpenMapTiles.
All thanks to an amazing guy in Ukraine, who's still actively working on it today.
🚀 Feedback Wanted: "Header and Footer Script Adder" Plugin for WordPress
These are bad plugins, they undermine source maps and make it overly difficult to trace back styles. Try redesigning one down the road on any reasonably sized WordPress site.
Presenting custom Gutenberg blocks to clients
The painful truth is that well thought out ACF is still easier and more intuitive. I can build a system with it that needs no manual, can't do that with Gutenberg though.
Non-Profit Needs to show programs and link to registration on wordpress
WooCommerce is overkill for the setup, keeping it minimal offers faster performance, easier maintenance, and fewer compatibility issues.
- Create a custom post type called Programs for each offering
- Add ACF fields for details like date, price, and registration link
- Use taxonomies for age, season, and theme filtering
- Build an archive template with filters and program cards
- Add a Register button linking to a Stripe Checkout session
- Handle the checkout via a REST API endpoint using Stripe PHP SDK
- Redirect users to Stripe Checkout and back to a success page
- Use a webhook to record successful payments and registrations
- Store registration data in a custom table or CPT
- Display registration details in the admin area for management
Need Expert Advice on Improving Site Speed
Looking at the report...
- Increase cache lifetimes for static assets to at least one year.
- Defer or async non-critical JavaScript files.
- Inline or preload critical CSS above the fold.
- Host fonts locally and use font-display: swap.
- Combine or subset fonts to reduce size.
- Remove unused theme and plugin scripts.
- Conditionally enqueue assets only where needed.
- Reduce DOM reflows by defining element sizes in CSS.
- Enable gzip or brotli compression on the server.
- Use a CDN for caching and image optimization.
- Lazy load all offscreen images and iframes.
- Preload critical CSS and font files for faster rendering.
Speed optimization
CloudFlare at the DNS level can usually help. Use their official plugin to properly configure caching.
Could AI be inflating my website downloads?
Highly likely, yes.
If you have CloudFlare check their AI bot analytics. Or check Google Analytics for utm_source (or Session Source) values. For PDFs downloads it's a little tricky, but you can make a safe assumption based on visits to the landing pages that link to the downloads.
Wordfence Free or Paid Plan?
Never liked Wordfence, properly managed CloudFlare I do like though.
Wordpress website
The theme has nothing to do with any of this.
Introducing Voxycure Framework
Nothing.
How often do you find sites with TWO page builders installed?
Way, way too often.
Is the WordPress plugin ecosystem becoming too bloated?
The gross over-dependence on WordPress plugins is bloated. That's the real problem I think.
I've been an advocate for building minimal systems with WordPress for years, and right now is absolutely the best time to do it because if AI/LLMs.
About more features in the core, absolutely. There are so many things that make absolutely no sense about what's been included in core and what hasn't.
Not included...
An interface for building forms for custom fields SEO metadata management Site sync/migration tool
Included...
Emoji's Customizer Email to post XFN Hello Dolly Commenting
These things make sense as plugins in my opinion, enhancements for the edge cases that want/need them.But every site I've ever worked on needs better ways to manage content, and SEO metadata management.
From Intel 2019 to M4 Max: First Impressions
Same here, and I will say its pretty eye opening to see how snappy it can be b/c its not clouded out big time
What happened on this day? How did 2 visitors rack up so many more views than usual?
Bots, possible AI learning
Why did installing an SMTP Plugin change my page layout?
Fun fact, you can send SMTP emails with 11 simple lines of code. The fact that a "premium" plugin is widely used for this kills me:
How do you track multiple client site info? Software or spreadsheet?
1Password, critical to keep this information secure.
Curious to know what methods you're using to collect donations online
Stripe can be configured to accept donations, it's not commonly used but is very simple and effective:
U.S. Trademark Office Issues Final Office Action Refusing Registration for "Hosted WordPress", "Managed WordPress"
Fair outcome
WooCommerce or SureCart? Which one should I choose?
Using Stripe directly would be my approach.
How is done a scalable Wordpress site in 2025?
Headless is good for a static site, extremely good performance, or corporates with high security profiles.
WordPress like anything else can be used to power a very fast site if you know what you're doing. The general recipe these days would be something like:
- Host somewhere good like Kinsta
- Use and tune CloudFlare
- Build a custom theme that does exactly what you need
- Use as few plugins as possible, only what is necessary
- Look to add functionality in the simplest way possible, using minimal functions and code before pulling pligins into the mix.
- Follow good development practices for performance
If you think of WordPress as a framework rather than a type of site it can be really great.
Received this error message out of nowhere.
Check your server error logs, and if needed enable WP_DEBUG to display the underlying issue on that homepage.
Plugin idea: LLM traffic analytics
Wishful thinking, but imagine visiting a site and immediately being asked, "Hey, what did you type into Google to get here?" You'll be feeding a major spike in your bounce rate, and just pissing people off by getting in the way.
The best analytics I've found is CloudFlare's AI analytics in beta right now. Google Analytics also provides some ways to do it.
Over 50% of plugins in the WordPress repository haven’t been updated in 2+ years
Why should they need to be? If they're well built, maybe nothing is wrong... hell I have a plugin on there that I haven't updated in 12 years, and it works perfectly.
You have to remember, a lot of those are totally free and there's not a $1 to be made by the contributors/authors. I honestly wouldn't expect them to be on the hook for bending a knee to the support every single core updates.
How best to display a collection of 300 items In Wordpress please?
This is a jQuery/JavaScript table enhancement that will allow you to load rows into a table that are fully paginated, among many other things. It's built for this exact scenario.
For a custom build I'd use something like Vue.js or Svelte to load in data on-demand.
WordPress Speed Optimization: A Practical Checklist for Website owners (and Busy Devs)
This article outlines many of the things I'd recommend looking at:
https://pantheon.io/learning-center/wordpress/woocommerce-checkout-slow
Query Monitor is good, but you're only able to test the checkout speed yourself.Take a look at a lesser known plugin called Index WP MySQL For Speed. It has a database monitoring option that can be used to log slow SQL queries as they occur. This is a much better way to understand what's going on in a production environment in my experience. The plugin can also improve database performance quite a bit as well, just be sure to backup your DB before applying any of the indexes it recommends.
WordPress Speed Optimization: A Practical Checklist for Website owners (and Busy Devs)
I asked AI if it was likely written with AI...
This post is very likely AI-generated or AI-assisted. The clues:
Highly structured: numbered sections, consistent headings, exhaustive coverage.
Generic tone: neutral, instructional, little personality or opinion.
Copy-paste code: ready-made snippets and commands.
Broad scope: covers every tactic rather than focusing on lived experience.
Stock ending: “GOOD LUCK OPTIMIZING! 🚀”
It could have some human edits, but the style points strongly to AI.
What's the best plugin or the plugin combo for Google Ads, Google Analytics, GDPR and Consent Mode V2?
Adding a single function to load a Google Tag Manager container script on the wp_head action hook.
No plugins, definitely no plugins.
For compliance look into how to properly configure Google Consent Mode in GTM, and for a cookie consent opt-in banner I recommend cookieconsent.com, it's free but you need to understand and implement it correctly for it to actually be compliant.
Switching to WordPress from Wix
Hosting a self-hosted install on Kinsta is effectively going to manage updates and security for you.
The theme marketplace and process can be pretty crazy though.
New posts not showing in the "blog posts" block
Second this: definitely need a lot more info. It sounds like clearing object cache with the CLI might do it, but without details on the caching layers/systems there's no way to know.
Possible to have a shorter article title displayed on my site's newsfeed and a longer version of the title when you click into the article?
^ Best way to do this.
Bot fight mode instead of wordfence
Wordfence seems to do a lot, but I'll say this:
I've worked on some very secure sites, with pretty high profile exposure, that don't use it. But they do use CloudFlare.
User/Visitor can select from 8-10 color themes?
If it were me, I'd create a simple dropdown menu in my theme, probably in the header.php file, that listed all color theme options. Then with JavaScript I would update a class on the
tag like "theme-bright" for example. Then in my theme I would define CSS variables for the colors that change, and reference them throughout the site's styles. When the dropdown changes, the CSS variables change, and the theme coloring changes completely.I don't think you'll find a plugin that automagically does this in a cleaner way.
What tools do you use to sync content between WordPress environments (dev/staging/production)?
I use git, WP CLI and rsync.
Its fast, requires no plugins, and allows me to sync precisely what is needed. Some corporate sites I work with use Migrate DB Pro to allow CMOs to move content between environments.
But... your pain is real and every WP developer probably feels it.
The biggest piece of advice I have is that code will always deploy the smoothest. Use content management selectively where it makes sense, and avoid it if you're ultimately the one making the edits. Especially with AI now, the smoothest way to move between environments is to avoid the database altogether.
Need Help Switching Providers
I'll say it, I don't like WooCommerce. When a site gets old, or your product catalog is large with many products, this becomes common.
If you have many old orders in the system try backing up the database, then clearing out all orders older than a year or so. Kinsta is a very good host, well above Hostinger in terms of quality for a WooCommerce site. I'd recommend that, they'll migrate the entire site over for you for free too.
That said the host won't be a silver bullet, the site itself is likely the issue.
I can’t find the mistake
I think you have multiple get_header() calls in your theme. Maybe one in header.php and another in page.php. That will load your header twice like this and show duplicate titles.
Drowning in Spam - Is Google reCAPTCHA Enough?
Security by obscurity isn't security, but I'll be damned if it isn't the best form of spam protection. I build funky forms that do slmething different enough to make it not worth while for a spammer to find ways to bypass it. Also allows me to pass submissions through AI APIs which works real well.
When you use a widely used plugin like Gravity Forms there's just no way to avoid it. Even with CloudFlare turnstyle you'll still get some, but turnstile is significantly better usually.
Built a form plugin for WordPress — would love your feedback
Spam protection is going to be your biggest differentiator. That's the biggest pain point for all of the existing ones, many of which are very good and have all the features you'd need. The bigger the audience, the more beneficial it is for a spammer to find a way around it.
I made a plugin to profile the loading time of every active plugin
I have a long-term grudge against GoDaddy for destroying that gem.
LCP great in lab test and awful in the field
I'm referring to the X-Cache HTTP header:
"The X-Cache HTTP header, while not a standard HTTP header, is commonly used by caching systems, including Content Delivery Networks (CDNs) and proxy servers, to indicate whether a requested resource was served from the cache or not."
Totally different from XCache in PHP.
Design Work Flow
Depends on the site, but there's always the old saying:
Good designers borrow, great designers steal.
Inspiration is a great starting point, because at this point there is definitely someone else who has put a lot of thought into what you were designing and has released a website that does it well.
LCP great in lab test and awful in the field
Revised answer here, because a lot of the suggestions are off in my opinion.
Most likely source: that video in your hero on the right hand side.
More generally though:
LCP measures how quickly the main content of a webpage becomes visible to users. If it's slow I would typically look at the following:
- What is Google identifying as the LCP issue? In this case it's an H2 element.
- Are all images lazy loading?
- Is there a YouTube video lower on the page, or other video/iframe embed that is preloading?
- Test your LCP without analytics scripts to rule out third-party code. To do this I conditionally bypass loading GTM/analytics tags with some code when ?without-analytics is added onto the end lf the URL
- Test the LCP without web fonts, this is especially relevant when Google identifies an H2 or other HTML tag like this
Short list to check:
- Lazy loading for images, videos and iframes
- Third-party analytics and advertising scripts
- Web fonts
The HTTP header I originally mentioned could be relevant too:
x-cache: MISS, HIT
Generally it's an issue I see with a lot of Elementor sites.
Can a Wordpress website handle 1 million+ traffic?
I've worked with numerous sites on Kinsta that serve more than 2M per month, the approach to every aspect of the site should really be different.
Funny thing about this and every "Can WordPress do..." question is that the answer is really can you/your team do it. WordPress is just a tool, a means to an end.
how do I get event label and event category parameters from event click in google analytics 4?
Yes, you're tracking them by adding those properties. They won't appear in the GA4 UI anywhere unless you add them as secondary dimensions, but when you do they'll be available.
Broke My Home Page
I mean that play and mentioned in that error, seems to be called pro-elements
Migrating content from one page builder to another
You're 100% correct, and to be more specific the truth is I typically don't recommend them for any site that could ever have more than 200 pages. the thought behind this is that the migration will be overly difficult and they'll be stuck with it. I also never recommend them for any e-commerce site as well. but for a smaller site with a limited number of pages they're great. my other gripe is that they do make it very hard to preserve a brand, but again that depends on the business and their requirements.
Archive a website for reference
Heritrix: open-source tool created by the company behind wayback machine
Plugin just released - but how to get the word out?
honestly find people in places like this who are struggling with the problem that it solves and help them solve the problem with your plugin
How To Find SQL Injection Vulnerability in WordPress Plugins and Themes?
when you submit a plug into the official repository for WordPress it has to pass a series of tests one of which is a sequel injection check. you can run these checks yourself using this same plugin:
Does anyone know of a basic link directory plugin?
Prior to 2012 WordPress actually had this as a built-in feature called the blogroll, they removed the future but left the underlying database tables.
you can use a plug-in to re-enable this feature and use it, it fits your use case perfectly:
https://wordpress.org/plugins/blogroll-links-renderer/
full disclosure I've never used this plugin, but at first glance it looks promising. basically finding a way to re-enable the blog roll feature is what you need.
Trying to Find Best Way to Fix Hacked WP Sites
Sucuri.com
They have a flat fee service that guarantees they will remove the malware and they do it all for you.
Choosing a suitable CRM.
You could definitely do this with HubSpot using their apis connected to wordpress. a cheaper alternative for smaller companies would be Zoho CRM.
How good is the workflow using Timber/Twig ?
Bricks is similar to Elementor but preferred by developers because it generates clean code, and can easily be extended with code.
that would be my number one recommendation for you
Track visits from different links based on query string
Use links with UTM tracking parameters added to them, generated as QR codes.
Kinsta Traffic Significantly Higher Than WordPress?
you can see all the traffic in Kinsta under the access logs, but I suspect what's happening is that your WordPress stats are based on trackable hits to your posts. Kinsta is reporting hits to your server. you can reduce it by putting cloudflare in front of your server, that then reduces the hits to kinsta and therefore your billable that's. and cloudflare is free, even at the free plan you could do this.
Are you using any Popup Maker alternative?
FWIW
It's really simple to code a basic modal window that displays in very specific use cases. that's really the best way, because you can control precisely where and for who that model appears to avoid it being a nuisance or annoying. and let's be honest those things are annoying.
if you were to use chatgpt or Claude:
"provide me with a single JavaScript file that will load a modal window with this form embed code inside of it when a user scrolls 50% down a blog post page on website.com. once they see the modal store a session storage value to avoid them repeatedly seeing it again"
You could drop that in Google tag manager as a custom script, zero plugins needed and no code edits to your actual source.
Absurdly fast image loading speed in Midjourney
I believe what they're doing, beyond the aspects already mentioned, is loading a static image initially of the first frame of a video and displaying that while the video preloads or lazy loads on top of it. Once the video loads it looks the same and just begins playing, it's a great way to preload an MP4 video seamlessly and have a feel very fast and quick loading.
They're also very good at optimizing their MP4s
Jetpack
Don't use it, in all honesty I see it as a plug-in that was built for automatic to track people on wordpress.org sites. You can definitely live without it enabled.
Migrating content from one page builder to another
The number one reason I don't recommend page builders.
Anyone tracking if their site is showing up in ChatGPT or Perplexity answers?
Yes,
Google analytics has it now as a custom attribution value. When AI prompt links point to your site they will have a UTM source set that you can use for attribution tracking, I believe this is what Google analytics is pulling in.
Cloudflare analytics is still the best source though.
The template changes on its own. Can someone please help?
Look into adjusting your optimization settings in the elementor settings area, tweaking those settings should avoid the situation but it's hard to say exactly which ones you need to fiddle with.
What’s new for developers? (August 2025)
ChatGPT 5
58 Plugin Wordpress Speed Own High End Server
Using a specialized WordPress host like Kinsta will save you hundreds of hours and provide a site that's just much more stable secure and fast and you could replicate unless you're a skilled systems admin.
Looking for Advice on Theme
Respectfully there is one thing I don't really understand: you've describe a scenario where the current theme has worked well for some time and people internally are comfortable with it. given that we now have ai tools that can do a lot of code for you I'd recommend keeping that theme especially if it's working.
Give the latest chatgpt 5 or Claude a try if or when you hit scenarios where you're not sure how to do something. If you can get your sites replicated to staging sites it should give you a safe environment to try this out.
I have to mention it, this is the exact work I do: creating minimal smart themes that last a very long time for businesses like multiple websites. I had one used on the TripAdvisor blog for 13 years, and a bunch of others that are still online today and have been for more than seven or eight years. these sites are by no means not content managers either, in fact there are circumstances where marketing managers can do just about everything without me. it's just that the CMS has controls for what needs to be controlled, and other aspects are automated and cleanly developed for speed and zero maintenance.
Here are a few other site samples, reach out at kevinleary.net if you want:
paperlessparts.com
puck.news
bastille.net
netbraintech.com
cred.ai
Redesign thumbnails - visitors not understanding where to click.
You could do something like this:
but honestly I think the problem might be that when you do click one of your images it's very slow to load the subsequent page, I'm on an Android tablet right now and I wasn't quite sure that I tapped the image because it took so long to actually get to the next page.
Best Plugin for Square
I did a custom set up once with Square payments, it was very similar to setting up stripe:
https://github.com/square/connect-api-examples/tree/master/connect-examples/v2/php_payment
It's not a plug-in and more technical, but in terms of application programming relatively very simple.
Any tips for migrating an active marketing site from Webflow to WordPress?
There is a nice way to display full webflow pages right inside of a WordPress website frame, including the header in the footer from WordPress and then the entire body of a page from webflow. you can also just include an entire page from webflow as well, but in the circumstances of a migration from webflow to wordpress this can be really handy because you keep some pages posted online as is while you work on moving content over by recreating pages.
What is WordPress' most useless feature and why?
WordPress removed the blogroll feature (Links Manager) in WordPress 3.5 in December 2012.
13 years later we still have the leftover wp_links in the DB schema
WordPress SEO plugin
Simple really: I want my SEO plugin to magically propel my posts to the #1 spot.
What you say is very true, there's a large gap in the market waiting to be filled for a simple simple SEO plugin for the masses. Quite honestly it's crazy it hasn't been included in the WordPress core compared to all the other bullshit that is somehow deemed necessary.
It'd be like having a new model of a car include a novelty horn you would never use, but not adding windshield wipers.
Broke My Home Page
If you don't need that Pro elements plug in disabling it should solve the problem.
Typical plugin development workflow when dealing with database
The WP database is very difficult to rollback in pieces because of the way WordPress assigns incremental IDs to posts. It then uses post records for all kinds of things like media attachments, menu items, posts, pages all post types etc.
The fact that all those are dumped into a single wp_posts and wp_postmeta tables is a huge headache.
The wp cli provides ways to export a database and then re-import it, and in circumstances where I need to sync up complex sites I typically use a custom wpcli script to slice and dice and sync up certain aspects of a database safely.
Application frameworks like laravel use a concept of migration scripts, similar patterns could be created with custom wp cli commands as well and I have done this to launch and roll backs in aspects in certain rare cases where it makes sense.
[HELP] Is there a plugin or code to migrate Elementor site to Gutenberg?
There's no plugin to migrate ANYTHING to Gutenberg.
There is this, I've never used it and probably wouldn't recommend it but worth pointing it out:
Need Advice About DB Operation
no idea about your schema but I would do something like this that uses a boolean with columns to identify the action and the target:
user_id,action,target,status 1,follow,19283,1|0
In this example the target is a post_id.
I'm not a fan of the "store all history" approach, but it is situational. generally if it's analytics you're storing that might make sense, but for an application it really doesn't matter how many times somebody follows their unfollows something, you're just storing the current state of something. it's much more efficient to use something like this instead of storing every occurrence of the action.
Free plugin for error log tracking and filtering + more debug tools [perfect for devs]
Query Monitor works well for me.
Wordpress Docker keeps restarting apache2 until the Container reaches ressource limits and stops working
It's always funny to hear that Docker simplifies things. I've yet to find that to be true.
WordPress Elemntor Troubleshoot
You may need to fiddle with the config settings for Optimization, and also you can check your server logs to see if anything is shown there. Usually something like this would shelf is a warning that pointed to the source of the issue.
Wordpress site not working properly after migration
Usually checking the error logs for warnings and fixing them is the best approach, that usually identifies issues that would exist on one server but not another.
Wordpress for Membership Site w/ Subscription Bitcoin payments
Stripe accepts Bitcoin payments, so any option that uses Stripe for subscription payments would work. Don't use WooCommerce though, that membership system is a problem maker.
How to break into the international market as an experienced WordPress + Elementor developer?
Do you ever get responses to cold email outreach? To be honest if I were recommended to a person that had ever cold emailed me it'd be a firm no thanks.
Fixing the Activating 2FA error using the Google Authenticator on WordPress
There is a glitch where if the code is within 10s to the expiration I see in my Google Authenticator it throws that error, but as long as I submit a code before then it works. There also seems to be issues with servers that cache Set-Cookie headers like Kinsta, but you can avoid that usually in the host config tools settings.
SMTP Send Services Suggestions
Mailjet or Mailgun are good options, I think Mailgun would be $90/mo for 100k, both are a little easier to set up an Amazon SES but that is the cheapest option that I found.
Getting started with SEO
This is the best thing you can read to get started with SEO:
https://developers.google.com/search/docs/essentials
Understanding what Google wants is and always will be crucial. Then choose the tools to help support what they outline.
Does Media Library's "scale" feature work well to downsize images or does it make them a bit blurry?
wsrv.nl is my go to way to resize images with zero distortion.
usually downsizing any image will make text and other fine details a little bit blurry. Typically if you reduce size by halves it will be sharper because of perfect divisibility.
Broke My Home Page
You probably deleted a theme file, and the theme hierarchy reverted to using the next most specific template which caused a PHP fatal error. Thats usually the case when I see a white unstyled screen like this.
Open up wp-config.php and set WP_DEBUG to TRUE. Reload the page and you'll probably see the error.
What’s the best SEO tools/plugins you use?
Google Search Console + BigQuery
RankMath or Yoast SEO
Beyond this, custom code.
SEO is the really about the approach, not the tools.
Just use Wordpress
WordPress is by far the most flexible.
That's why it's the best and the worst.
How much i can make in 2023 as WordPress Developer ? IN or outside of freelancing platform
Kind of like asking how much you can make building homes. You could do nothing, or you could make a lot. It depends on your skill, the quality of output, and the clients you attract.
Is the niche for freelance WordPress developers a separate market?
Easy answer: you're much cheaper than US developers, when the market tightens here businesses outsource to cheaper alternatives.
12k in your currency is $2200 USD, below the minimum wage you'd make working at a fast food restaurant in the US.
How could a self-employed WordPress developer make 6000USD gross per month?
Have to be a realist here: charge $40/hr?
if that were my goal I would probably create a custom thing that did a very precise thing for certain type of business. then you can under bid agencies and win a lot of contracts, but you have to be clear about the limitations of working with your theme. maybe worthwhile considering it a platform for selling it that way.
What is it like as a Freelance Wordpress Developer?
I've been doing it for 15 years and the biggest drawbacks from a long-term standpoint:
Less marketable career skills for future development jobs
It's a hustle, unstable at times which can be stressful financially
You may find yourself wishing you were working on a single thing of high quality. Building a great fireproof building can be a lot more fulfilling then putting out fires caused by others.
The future of freelance WordPress work in the age of AI and Low/No code platforms
During the San Francisco gold rush the vast majority of miners made nothing and went broke. The real riches were in selling shovels.
While slightly different, a lesson can still be learned: businesses will all be interested in using AI, many of them to change the way they manage and create on the web. Think of all the ways it could completely change the way things are published and created today, there are without a doubt many opportunities there.
For those who are freelancers, how hard is to make at least 1100€ per month freelancing with wordpress
I think today it's entirely feasible, but I will say it is most likely harder than it was 5 years ago because of market saturation.
Reality is you're not the only one thinking of this, so just be ready to be in competition with many others. you'll need to be honest with yourself about how you stand out, and who and how you will market yourself.
Reality of WordPress Freelance
I made the choice to be a freelancer over an agency owner a long time back when the opportunity arose to become a partner at a pretty well known agency in Boston. I chose to work on my own, and I couldn't be happier with the choice. My goal was to automate as much as possible, cut out the BS, and focus on the work because at the end of the day I like doing the work, not managing others doing the work. I'll add one thing to this: I've met many people over the years who went the other route, very smart, very skilled people, and almost all of them are burnt out. An agency business model is very tough. It's hard enough to sustain as a freelancer, but as soon as you have all the overhead of an agency like office space, salaries, benefits, and everything else that comes along with owning a business, it quickly becomes hard to compete.
Is it possible to make a living as a WordPress freelancer and web designer for small businesses?
- One question is, is it possible to make a living solely by creating websites using WordPress, either as a freelancer or by creating websites for small local or medium-sized businesses?
I've been a freelancer for 15 years as well, working with businesses of all sizes: small, medium, and large.
It is, but at times it can be difficult, and I would only recommend it to somebody I know with the right mindset. You have to be able to jump from project to project as needed, which can sometimes make it hard to do deep focus on things, but if you plan your time well, it's not a problem.
The same goes for adapting to corporate cultures. There are some clients, usually startups, that are most interested in a working initial version that is relatively polished and done quickly. From there you'll iterate on it, but a small mistake here and there is expected in exchange for speed. Take this approach for a large corporation though, and you'll be in trouble. They're different, and there's a specific workflow to follow using something like Jira/Agile methodologies.
- Can you share your experience if you are a WordPress web designer and whether or not you are making money?
I do both design and development, but I wouldn't recommend myself and don't recommend myself for creating a fresh brand from scratch. When there's an existing brand or style guide, I can roll with that and preserve it and improve it as needed. That's typically the design approach I take. For fresh, very high quality brands, partnering with a designer to trade off work is a good idea.
Yes, you can definitely make money, but not without a strong work ethic.
- Can you recommend any courses for me to get started in this field as a freelancer or in creating websites for medium-sized or small businesses?
Not courses. This may be alternative, but find good websites for midsize businesses you're targeting and dissect them by viewing the source code. Even with just access to the front end, you can get a good understanding of what plugins, if any, they're using, what patterns in front end approaches they're using like Vue, React, or Angular, how fast the site is, what SEO optimization there is beyond standard plugins, and much more. You can pair this with scanning tools as well to get a better understanding of the site structure.
Design is harder. There's really no course for it. I actually went to school for graphic design, and I can tell you that there is no formula for making things look good. There are principles and approaches, but ultimately it comes down to a visual skill. That said, you can learn to get better for sure. The same approach is pretty good. Find really well designed sites and evaluate them in terms of how they're laid out, what grid they're using, how they handle variable content, fonts used, font size ratios, white space usage, and all sorts of other things that can just be seen by browsing around a site. My one piece of advice here is that when you visit a site and it just looks great to you, it's a combination of all of these things supporting one another.
- Do you recommend studying and learning JavaScript, HTML, and CSS? Should I focus on the basics, intermediate, or advanced levels?
Trickier question now that there are AI tools that can augment a lot of this. I may be old school, but I would say yes, it is definitely good even if you're using AI tools to generate most of your code, because that code will always need to be tweaked and adjusted, and in the future you'll probably be debugging a lot of it. But it depends on the type of WordPress designer. There are many that use page builders and can make well designed sites that clients are happy with with little code. I will say that these are the sites I end up cleaning up in the future for people, but that's not to say that there aren't people making a living off of building them.
- Do you recommend purchasing paid plugins before starting this project, or should I use free plugins for the projects I receive and purchase paid plugins once I start receiving money? I ask because I currently don't have a job to afford paid plugins.
Take this with a grain of salt, but paid plugins are best avoided. They slow down the site by making constant HTTP requests to verify licenses. They make it hard to create your own systems and patterns for reuse. Probably most annoying is that they require constant and never ending updates for two reasons: one, the developers want to continue making money, so they keep adding features or adjusting features so that you need to upgrade; two, they are a high security risk in most cases because they have been built with a very large code base to suit the needs of a very large audience. There's very little money in creating a premium plugin for a small niche edge case, but most of the clients that I work with want a precise solution to cover that edge case.
I would learn about how to create a plugin from scratch and use AI tools like Claude to generate code to do what you want specifically, but I would definitely recommend understanding that code by learning it. Early on in my career, I read a lot of books about PHP, CSS, and all kinds of other development.
- Do you recommend that the hosting and domain be purchased by the business owner or the client who contacts me as a freelancer?
Absolutely yes, I always recommend this. There are some devious agencies and freelancers out there who would recommend otherwise, but when you work with a client, you ultimately want to think of it as someone who will likely reach out to you or refer you in the future. If you aim to make it overly difficult for them by owning the domain and hosting, you're really only doing yourself a disservice.
- Could you give me advice on how to approach starting in this field, as it seems very abstract to me and I'm not sure if it's possible?
It highly depends on your background and experience, to be honest.
Finding freelance WordPress Developers
Codeable should work well if you want a developer who does what you want without much in the way of strategy or suggestions. While you can get strategy and suggestion recommendations, the reality is that as a developer on that platform, it's less profitable than just doing what is requested. I inherit a lot of WordPress websites these days, and many of them are quite honestly an absolute mess.
Not to say this is associated with Codeable in any way, but it is associated with a general mentality of getting things done as quickly as possible without worrying about future consequences. A lot of the widespread issues on these sites I see could have been avoided easily with a better approach at the start.
Is it possible to get freelance work as a wordpress developer in 2023?
The best advice I have for getting good clients is to do great work when you're starting out, not just in terms of getting what is requested done quickly, but in terms of understanding a business and making proactive recommendations that will help the person you're working with achieve their organizational goals.
The best clients I work with are those with whom I continually build strong relationships by showing up, doing good work, making good suggestions, and working with their existing teams, not against them.
Where to find freelance wordpress developers?
I'm a well-experienced freelance WordPress developer with 15 years of experience, so this is going to be controversial. I'll start by saying that Codeable and similar platforms are great, and I often recommend them to people who reach out for work requests when they're honestly better suited.
This is a little bit long-winded so I'll cut to the chase up front: Codeable is good if you need a request in, output out relationship. You tell someone what to do and they do it, with little recommendation or strategy involved. Sometimes this can be damaging to a business in the mid to long term.
But from a developer's perspective, Codeable forces more of a "get it done now, worry about the consequences later" mentality. Unfortunately, this is already very common with WordPress websites built by agencies, but for a business owner there are many reasons to be cautious about it. You also typically will lack in terms of strategy and future-forward recommendations.
Let's look at an example: recently I worked with a business that needed a better, more reliable way to onboard customers. They had a hodgepodge setup more or less hacked in place with Zoho forms, modal windows, and a more or less page-by-page build approach. It worked but it was a jerry-rigged house of cards, and when they reached out to me things were falling down.
Initially they had reached out looking for someone to fix this house of cards, but after taking a look I leveled with them and said that we would probably continue to go back and forth on issues, which is not a scenario I or you would want. We discussed building a custom onboarding form, something more like what you'd see for an online software tool. The initial cost was higher, but we discussed the current lead generation scenario and deficiencies related to the current setup, and after calculating it out it would pay for itself quickly.
If I were developing this on Codeable I probably would have opted to fix the initial request, not because I would want to string somebody along but because that's the way you think as a developer on there: request in, output out. Most people are looking for the quick fix, but because we were able to discuss the business needs, the solution we came up with was much better measurably so.
For the business, the end result is an onboarding flow that doesn't break, is isolated from other WordPress plugins for stability and security, and generates a lot more leads than the previous setup.
I can't share the exact details on this project because it's still ongoing, but I can share two others I've done in the past if anyone is interested in seeing them. at the end of the day if the goal is stability, growth, and revenue it might be worth considering working with a direct freelance web developer.
WP Rocket - Is it worth it?
It will improve your site speed, but the question of is it worth it highly depends on how well built and optimized a site already is. If you host somewhere like Kinsta, and you use CloudFlare, then you'll probably only gain a 100-300ms boost in speed. For me the added overhead and extra ongoing cost isn't worth it for that.
Too many plugins
I see your point, but these days probably 95% or more of all plugins are very overweight unfortunately. I get the sentiment.
Too many plugins
This is funny, and true.
I built my entire website using VW and VH units for text and layout. How screwed am I ?
CSS clamp() to the rescue!
font-size: clamp(18px, 5vw, 36px);
That allows for a max and min font-size to keep things from getting too wonky
How do I remove sticky floating form?
Hunt it down, then take it out.
Persistent spam in 2025
Why do they do this?
Great question, I researched it once. They're looking for responses so that they can gather a huge list of real emails. Then sell that list with you on it for malicious folks who try to send you phishing emails, or sometimes just get sold to businesses who then spam you to buy stuff. Each known email connected to someone that gets a response is worth somewhere between $0.20-$1 a piece.Ever have someone call you, only to pickup the say hello and hear nothing, or have it drop? Same thing, just with your phone.
Unfortunately it's only going to get much worse with AI language models. Hate to be a doomsdayer but it's bad.
Rebranding with a New Domain . How to Best Handle SEO and Redirects?
Was going to suggest this too, you basically submit the change of address to Google through the search console after preparing everything and beginning the move.
One thing I've found really helpful is to use CloudFlare workers or redirect rules to make sure every page level links redirects perfectly. So that:
olddomain.com/about/?utm_source=facebook
would redirect to the new one with everything intact:
newdomain.com/about/?utm_source=facebook
Thats the #1 most important step to be honest
Youtube thumbnail from user created post
There's a pattern you can use to get a poster screenshot for any YouTube video:
https://img.youtube.com/vi/<video_id>/maxresdefault.jpg
For example:
Is there a way to get Yoast to auto generate meta descriptions without Premium?
I think Yoast has a way to bulk export and import as a CSV.
I'd export a .csv of all posts, filter it down to the ones you want to generate for, then upload that csv to ChatGPT or Claude and have them generate all the missing tags. Download the updated CSV and re-import to Yoast.
Import/create html pages
Definitely, I'd usually write a standalone migration script to do it:
- Connect to your database
- Create a "Newsletter" post type in WordPress
- Use wp_insert_post() to create all of those newsletters exactly how you want
It's the standard pattern I'd use for any migration from another CMS into WordPress.
Backup Wordpress Site
At the host level with snapshot backups, best to keep your CMS managing content and your disaster recovery at the source and behind the scenes. You also wont get charged for using storage space, like you would with Updraft or similar backup plugins.
Is it a bad idea to disable RSS on my WordPress site to stop content/image scraping?
CloudFlare can help you cut down on truly automated scraping like this. You can also put a clear copyright on your images if you make them, and in the EXIF metadata. That makes it clear, and doing it with a watermark is a great option. Turn those bots into workers that promote your brand! Just drop your domain in the bottom right corner of every image.
I do disable RSS feeds a lot though, they do make it very easy for people steel and republish.
Is it a bad idea to disable RSS on my WordPress site to stop content/image scraping?
CloudFlare can help you cut down on truly automated scraping like this. You can also put a clear copyright on your images if you make them, and in the EXIF metadata. That makes it clear, and doing it with a watermark is a great option. Turn those bots into workers that promote your brand! Just drop your domain in the bottom right corner of every image.
I created a free tool that converts existing HTML to dynamic Gutenberg Blocks with a single command
Wait a minute...
- Gutenberg is the future of CMS tools.
- CMS tools allow you to rapidly build pages without using HTML, so you don't have to code them.
- Coder builds tools to allow HTML to be imported into said editor, because HTML is easier to create than working with the tool.
No criticisms whatsoever about the CLI though, I'm there with you anytime I use any page builder: like I want to pull my feet out of cement so I can get back to running.
I have something kind of similar that uses https://github.com/alleyinteractive/wp-block-converter
MySQL 8.4 / 9.1: has anyone had any trouble?
Only in my localhost, but with MySQL I'd be cautious. PHP is easy to upgrade, but it may be worth looking at major hosts that support it first. WPEngine for example still uses 8, which would be a warning sign for me and I'd probably hold off. That said I run 9 in my localhost and have zero issues.
Seeking Feedback on Clutch: A New Free Visual Builder for WordPress
Webflow can be embedded in WordPress, which may be a good option.
Is there a plugin that sends 304 response code for unchanged pages?
No plugin needed, simple code can do it nicely with way less overhead:
add_action('wp', function () {
if (is_single()) {
global $post;
if (!$post) return;
if (strtotime($post->post_modified) < strtotime('-1 month')) {
status_header(304);
nocache_headers();
}
}
}); How do you work with editing Screen Options? Documentation is close to nothing
What about this?
https://developer.wordpress.org/reference/functions/add_screen_option/
I've used it a few times, this is a really good resource based on a quick glance:
https://humanmade.com/engineering/extend-and-create-screen-options-in-the-wordpress-admin/
Using QR codes to confirm a user has completed a task.
They find the QR code, scan it and get a URL that they then open in the browser. That's all you really have, QR = URL, so the URL in this case should be to a page behind authentication where they can pay for and access the "prize". It could be a simple Gravity Form with a hidden field that grabs a product ID from the URL, then displays the price on screen and allows them to purchase.
Anyone could share that screenshot with other people though, there isn't really any verification that a person found or reached that QR code on their own. You could verify the QR code against their location using the HTML Geolocation API though. That's pretty precise, and you could associate the QR codes with a specific radius around a certain spot. So people couldn't really game the system and cheat, at least not easily. The technical aspects actually aren't too hard.
The combination of the geolocation API and the QR code should work nicely.
How to load ACF values into CSS?
Adding it the wp_head hook is a good way, but I usually do it with inline styles because it makes sense to me. Programmatic changes like JS are good to see as overrides in my opinion.
add_action('wp_head', function() {
if( is_admin() ) return;
global $post;
if( ! $post ) return;
$scale = get_field('bounce_scale', $post->ID);
if( !$scale ) return;
echo "<style>
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale({$scale}); }
100% { transform: scale(1); }
}
.pulse-element {
animation: pulse 1s infinite;
}
</style>";
}); How to automatically make a certain word always have a certain link?
12 years ago I wrote a plugin to do that exactly.
https://wordpress.org/plugins/internal-link-manager/
It's old, but still works like a charm with the latest version of WP.
Can I build this with Gutenberg?
If by build you mean code a block here's a good way:
- Add a custom block with ACF
- Attach a field group to the block with a relationship input that allows multiple selections
- When creating the ACF block you can load a basic PHP template, CSS stylesheet and JS for that block specifically.
It's a good sane way to work with Gutenberg as a dev, without having to deal with the overly complex approach provided by the core.
Website feels slow but has really high google page speed insights?
What's funny is that many of Google's product landing pages fail core web vitals tests. Give it a try for cloud.google.com, it has a failing score.
How Often Do You Completely Redesign Your WordPress Site?
My all time favorite online business: craigslist.org (no joke)
$694 million annually with roughly 50 employees, all with the same design that's never changed.
How Often Do You Completely Redesign Your WordPress Site?
Iterations only to kevinleary.net since 2008 have been going pretty well. No real redesign, just constant improvements to make it better and better.
Best caching plugin for a Roots Bedrock Wordpress site?
Optimize at the host level, and DNS w/CloudFlare. Performance plugins are for chumps
object-cache.php with Redis, Page cache with the server, Edge cache with CloudFlare
Site Keeps Failing Security Metrics PCI Compliance Scans
Setup CloudFlare and you can handle that at the DNS level, regardless of the host. A very good way to manage it too.
Squarespace User Being Pressured to Switch
I'm a very skilled WordPress consultant, and I know a whole lot about SEO. Google "wordpress consultant" in the US and I'm in the middle of the 1st page, or "bigquery consultant" and I'm #1. I don't like squarespace.
But here's my advice: what I'm hearing is that they like working with WordPress and can do a lot more with it. SEO is honestly about providing the best information, while it's true a skilled SEO can do a whole lot more with it the question is what are the specific goals for your organization.
I'd suggest writing out a simple list of what you specifically want to acheive with this new site. Obtainable goals, not loose fluffy stuff like "a better experience" and "more exposure", i'm talking about "rank on the first page for ..." and "10 organic leads/sales per week". From there I'd look at your competition to see what kind of content they have and then determine how to outrank them. Come up with a vision of what you need/want, then evaluate the options against that. It sounds simple, but rarely do I see people actually do it.
Just because I specialize in WordPress, and I can do a whole lot more with it on my own site and other specific sites, doesn't mean it's best for every company that I work with. If WordPress or any other system is the only option a consultant ever recommends it's a red flag in a lot of ways.
Whats the current site? Happy to provide specific advice based on it.
Final thought:
I typically only recommend switching from Squarespace to WP in two broad scenarios:
- Sites with more than 100 pages become slow and unwieldy to manage in SS in modular ways
- Sites have integrations they just can't do in SS like custom analytics event tracking for advertising, or Hubspot/SalesForce forms integrations
If you can manage everything you need right now with SS I'd be hesitant to switch. I audit sites for SEO all the time, some pretty big ones too. If you need a little more expert advice to balance out those whispers send me a DM
We launched another table plugin for WordPress – here’s why
You mean the block editor that's been in WP core since 2018? Better hop in your delorean to call that the future.
Generally I'm not cynical in my posts here, but this seems like a shameless promotion to me.
Database hygiene: removing junk data
Manually is the only real way to go about this. I typically create a migration script made up of WP CLI commands that I can run on a remote site afterwards. But most of the work involves:
- Research any custom tables and check if they're actively used by any plugins
- Removing orphaned data, most often this is wp_postmeta and wp_usermeta that's leftover from removed users and/or plugins.
- Removing post types leftover from plugins that have since been removed
Usually that's the bulk of it to be honest. Its good to do on any old site, especially when its gone through a few rebuilds/redesigns om the same install.
Ewww
These days I need very tall boots, maybe even hip waders.
Am I the only one still using the old classic editor?
Classic Editor plugin... 10+ million active installations, the #1 most used plugin that exists.
I don't think so, not by a LONG shot.
WP Rocket discontinue infinite license whilst having insane price hike
Ditch it, use CloudFlare and a good hpst like Kinsta instead for less money and a far better outcome.
Gutenberg + Spectra or Bricks Builder in order to replace Elementor?
If you like Elementor and are familiar with the Bricks is a good alternative, it's basically what you're after: Elementor that isn't slow.
Elementor is Not as Bloated as People Say
Try using a site with 1000+ pages that has it, or any site with WooCommerce or logged-in user sessions. It scores decently when viewed as a fully cache frontend, but your admin workflow will never be fast.
How many plugins are too many?
Solid gold right here.
90% or more of your plugin code isn't needed for your specific use case, and it's slowing down your entire site. Particularly premium/pro plugins that make constant requests to verify a license key, and also track usage stats and analytics too.
What’s the Most Underrated WordPress Plugin You Use?
Hello Dolly, most useful plugin ever! (joking)
Not well known or used that much, but it is well rated. For big sites with database issues Index WP MySQL for Speed is great. It makes a big bloated WP database noticably much faster and more performant.
https://wordpress.org/plugins/index-wp-mysql-for-speed/
Second is "Google Authenticator". Hasn't been updated in years, but it comtknues to be rock solid and it does one simple thing well: adds a MFA for Google Authenticator to the WP logon.
How should I republish articles on personal portfolio site?
Publish them on your site and set the meta canonical tag to the original URL. That avoids all SEO issues and is what Google recommends:
https://developers.google.com/search/docs/crawling-indexing/canonicalization
There are ways to import them, but you would need access to the source site WP install. RSS can actuallybe used to automatically pull things in.
If you don't have that I would typically view and copy the HTML source of the post body area.
Best plugin for downloading individual posts to hard drive
Not WordPress specific, but HTrack is a tool that will download an entire website to a folder you can open and view offline.
That can handle the entire site at once. If you actually want to read anything then Instapaper is a cool free app.
Tin Foil Hat Engaged
One and the same
Tin Foil Hat Engaged
99% of the sites I see like this can avoid the situation entirely by doing the following:
- Turn on the built-in auto update for WP core, plugins and themes
- Stop relying on too many plugins, you should know exactly what and where every plugin is for and honestly many plugins are complete overkill
- Add MFA with a plugin like Google Authenticator, or configure advanced WAF rules for the login
- Configure your DNS with CloudFlare (your own account) and fine tune your WAF rules to protect your /wp-admin/ and /wp-login.php areas
Not in any particular order either, the last one is probably the most valuable.
Is it better to only use custom theme and plugins in my projects?
Big sites with specific needs benefit from this approach significantly. I built a blog for TripAdvisor this way that was extremely fast and secure. It was online for 9 years using the same theme, spanning 3 rebrands and 9 different localized languages.
Yeah, I'm showboating a bit... but I'm proud of it. I maintained this site for them as a freelancer, and it was built in minimal ways that made it very low maintenance the entire time it was online. It never broke during a plugin or core upgrade, and was never hacked.
But I wouldn't always use this approach, it's best for specific situations. Out of the box functionality from plugins and themes can be fine, just try and keep things minimal and be mindful of the overhead. Agencies that insist everything must be hand-coded though... are nuts.
Existing reddit/quora like website created with WP ?
WPMUdev had a plugin that would replicate StackOverflow with WordPress. It's inactive, but still works and is pretty spot on for this:
BuddyBoss is garbage in my opinion though.
Simply Static: Blog Post Not Exporting! (no-save, no-follow)
Settings > Reading is probably set to block the site from search because you're on a localhost install. New installs default to blocking search like this, just untick the checkbox there and save.
To confirm this is the cause you can also visit /robots.txt
Any plugins for help with text over an image?
Gutenberg won't output anything like Canva, but here are two interesting ideas:
- If it's not a lot of text, take a screenshot of it in Canva then upload it as a standard image. Ideal if you're already writing in Canva then moving into WP.
- Export from Canva as HTML, then import into an HTML block.
- Try out the Canva plugin for WordPress: https://github.com/WPPlugins/canva
If you use #1 make sure you put the text in the image into the "alt" data for the image before you use it in WordPress. This is a media library input field that appears after uploading an image in WP.
Good freelance alternatives to Fiverr
Most likely anything.
A generalized answer, for a generalized question. Nasa.gov is a WordPress site, and also a local laundromat near your house. The freelancer you need for either is going to be pretty different.
LinkedIn might be good, looking around Reddit, or honestly searching for a "wordpress consultant" might work well. Totally depends on the sites though.
Site Still Slow Despite Caching & Optimizations – Need Advice!
Nobody has asked the #1 question yet, unless I missed it?
What's the URL to your slow site?
I'm 100% certain that you'll get no gain from switching away from Kinsta. It's a very good host, and I say this with a very good understanding of whats under the hood.
Something in your codebase is the issue, but there's know way to know what without looking at the site itself. You can run in circles doing all the stuff everyone mentions here, but a lot of it won't make a noticeable difference.
Think like a doctor: diagnose the specific problem before you jump ahead and try any treatments.
Created a WebP conversion plugin for WordPress in Cursor and it works brilliantly. If you need a WordPress plugin, just ask Cursor to build it for you!
Been doing it for years with a basic web URL:
https://wsrv.nl/?url=https://images.pexels.com/photos/3913025/pexels-photo-3913025.jpeg&output=webp
Zero overhead and no code necessary, take that AI!
Not a critic though, its great that generating a plugin with AI tools is possible just be careful. You can really shoot yourself in the foot. You may end up spending more time fixing trouble down the road.
Custom CSS for a specific page
Glad I could help!
Looking for feedback on a Roots Sage alternative theme I've built
This is exactly what I'm looking to avoid: stacks upon stacks of unnecessary abstraction.
Why Is This Still So Messy in 2024?
What made WordPress so popular can also make it terrible: tremendous flexibility.
Imagine if building a house had zero limitations, restrictions or standards whatsoever. You'd have a small percentage of craftsman carpenters that built good houses that stand the test of time. Those houses can be made so that they're easy to fix, maintain and renovate well into the future. Then you'd have a huge workforce of hacks building houses however it worked best for them, with little regard for the homeowner. You could buy a house like that for cheap and save some money up front, but you'll quickly end up paying more for repairs and maintenance and you'd potentially have a house you absolutely hated. Then you'd tell your friends that building your own home sucks.
What does your Wordpress dev environment look like in 2025?
Bare metal nginx/mariadb setup SASS for styles Twig for templating/views Native JS modules Browsersync for compiling scss and for love reloading JS, php and view changes during dev work Frontends with complexity use Vue, or are done headless.
The localhost server is a very similar stack to WPEngine Local or Kinsta's dev server tools, but I'm able to do some nice things with complete control like proxy my uploads folders, among many ofher things to optimize my workflow.
Agency owners: how much do you pay the talent you outsource?
From a dev's perspective, this is probably what results in some of the worst quality work I inherit. There are ways to build things for just that scenario much faster than you really should build it. When change is needed, those systems can crumble.
This is a big assumption though, it's an entirely situational. I just know that I inherit a lot of sites built by agencies with work is like this. Somewhat of a house of cards: looks good today, PITA down the road.
Agency owners: how much do you pay the talent you outsource?
I'll share the flip scenario from a contractors point of view: make money however you like, it's your business not mine. More in general, that's what business is. I price my work and you price yours. One really doesn't have anything to do with the other.
I charge $$$ per hour, which some may think is high, but I know some of the projects I've built have been >$500k budgets. I billed the same amount there as I would for a $10k quick build. But it's a two sided coin: I bill for 100% of my hours, and if that cuts into profit on a project that's not really my business.
Hiring someone for a Custom Wordpress site. Should I do it?
I build custom WordPress websites for clients similar to you, but ultimately I help people build the ideal website for their circumstances (WordPress or not). My professional recommendation would be to consider Squarespace instead of WordPress this project for a few reasons:
- It's zero maintenance
- You can do everything yourself, very easily
- It's not difficult at all to create a professional design even if you're not a designer
You're significantly more likely to end up with a website that is vastly superior to what you would get with a $500 custom WordPress site.
Looking for feedback on a Roots Sage alternative theme I've built
The way this has been built you can easily use Astro or any other template language you like. The view system is very simple, making it easily replaced.
If you really want CMS agnostic Storybook is probably worth looking at too.
Roots Bud is very slow, and to be honest this will always be faster than Vite can ever be because JavaScript isn't compiled. Browsers support native ES modules so there is really no need to compile and pack.
Also, gzip compression without minification is plenty fast, gzip does the bulk of the file reduction based on benchmarks.
Best way to add code snippets with minimal impact?
Tag Manager is best, that separates analytics and advertising work from web developer, allowing you or other team members to implement and optimize in a safe area. It also provides good ways to preview and test your changes before making them live, records versions of all changes made that you can rollback to. Finally, it has protections in place to check any code functions you do add, to keep anything from totally breaking your site.
Looking for feedback on a Roots Sage alternative theme I've built
I've built a minimal WordPress theme to support an upcoming Smashing Magazine article I've written and am looking for developer feedback.
The goal is to show that it's not only possible, but actually very beneficial, to develop a custom WordPress theme with modern development patterns without a complex framework like Roots Sage. The theme itself is more of a living example at this point, meant to show the benefits from building minimally vs. using a framework.
Looking to get some feedback and initial thoughts before the article goes live, specifically if you're a developer that's worked with Roots Sage at some point.
The theme source is available on GitHub at https://github.com/Kevinlearynet/minimal-wordpress-theme
I reached out to developers that use Roots Sage at their agency and specifically asked what they like about, with details. The most common answers they gave became the focus of the features currently found in theme:
- BEM SCSS w/o Tailwind
- Watch and build scripts that run in under 100ms
- Hot module reloading localhost:3000 server for dev provided by BrowserSync
- Fully supports native JS/ES modules
- Twig templating with small set of global context variables and functions
- Optional cleanup of commonly removed features (emojis/application password
- Composer dependency management
- Namespaced PHP for isolation
The reasons why I find this to be better than Sage are based on my experiences working with dozens of Sage 9 and Sage 10 built themes long term.
- Easy stack traces for syntax errors in view templates
- Simple structure with virtually no learning required (if you've coded standard WP themes before)
- Twig is faster than Blade and can handle significantly more requests
Overall I know people really like Roots Sage, and I understand why agencies choose to use it for standardization. I've inherited and maintained many high end agency built themes that use it, and have found that it creates far more problems than it solves.
Let me know your thoughts, both good and bad. I'm very curious to get thoughts and feedback on whether anyone shares in my opinions. Please keep in mind that this theme was just built, and I'm sure there are some kinks that need to be worked out.
I don't like web components. Here's why.
I see your point here, but I do understand the viewpoint of the author.
It's the conundrum of an aging developer. If you know an effective way to solve a problem well, one that you know through experience will work long term, it's frustrating to force yourself to learn something new. Especially when you're very adept with an existing approach that works well to solve the exact same problem.
Learning is rewarding when the skills you gain help you achieve things you otherwise were unable to. But learning a new way to solve the same problem gets old after a while.
How you guys are dealing with Sass deprecation warning?
I agree with this more and more the older I get: these problems just don't exist with a raw SASS scenario.
Which theme do you use with Bricks builder?
I think I understand the question though: typically a WordPress theme, like avada, comes with a design as part of it. Bricks doesn't out lf the box, only the child theme which really requires complete design from scratch.
If this sounds like what you're looking for then check out bricksdirectory.com
Form Builders for Word Press
I've built high volume onboarding forms for various sites in the past, each with pretty advanced validation to verify phone and email. I've tried Twilio's API too, which is good for what it is.
Here's what I use:
https://www.npmjs.com/package/libphonenumber-js
This is the JS version of the library Google uses for verifying the format of a valid phone number on Android devices. Literally inside of the Android OS. What it does is verify that a phone number could potentially be real based on the North American Numbering Plan NANP. That's free compared to Twilio, and to be honest with Twilio you still get bogus numbers. All someone has to do is enter in any number that happens to be actively in service. This was observed after a lot of trial and measure conversation tests.
WP site malware urgency.
Sucuri has a service that will remove the malware for you, which I'd recommend because quite often when you think it's gone there is still something lurking deep inside the DB.
They have a specific service that I think is a one-time fee to clean out for you:
Svelte + WP Multisite + Supabase?
Have you ever worked with multisite before? Even when the use case is right on point with what it aims to do it seems cumbersome to me. Particularly true if these sites will ever collectively have a lot of volume. The SQL schema generated by MU is... not good.
A while back I built TripAdvisor's blog for a very similar use case. They wanted MU but I talked them out of it. Instead we used a single installation of WP that supported 12 different international versions, all using the same theme shell but with different content injected in. tripadvisor.de/blog. tripadvisor.it/blog/, etc. This was done with an nginx reverse proxy, partially because they wanted these off the root tripadvisor domains.
That site was stellar in terms of maintenance and stability, and it was online from 2014 to 2022. Same custom theme the entire time.
You mentioned svelte, if I did that site today I probably would use it too. At the time it was AngularJS then Angular.
Nothing is Working in WooCommerce, on top of it, I am getting other people's cart totals ???
You'll need to disable any page cache that's enabled, either from a plugin or your server. The wrong totals in the cart definitely sounds like it's caused by that.
Personally, I really don't like WooCommerce. It feels like an over-engineered monster to me these days. There are actually a lot of advantages to making an eCommerce site minimally with a system specific to what you're selling. Woo just tries to do everything for everyone, and oftentimes delivers a lot of craziness and frustration.
Best Host for Beginner
How many of the "shitty" hosting companies have you ever used bud?
Best Host for Beginner
My first host was Dreamhost, back in 06' when I installed my first site. At the time it was nice and easy, and from what I've heard it still is. When you get some traffic you might want to use something like Kinsta, which is also easy and handles all the caching and security for you.
Avoid anything mentioning VPS or cPanel.
Using agency domain vs client setup for SMTP?
If you have a decent amount of clients with relatively high volume form submissions you should keep in mind that the junk flowing through those forms will basically be delivered from your domain. That email is effectively sending out the junk submitted in those forms, and when it happens often enough you could get flagged. Form spam is rampant now, so I'd highly recommend avoiding it.
Is there an easy way to migrate from this awful Bedrock nonsense over to regular Wordpress please.
I'm pretty experienced with WordPress and other web application frameworks, and I agree with this 100%.
If you want modern devops practices it's a lot better to go headless in my opinion. Then you can easily have great systems like branch based environments for all devs, etc.
Is the design awful??
One thing that might look nice would be contrast between the gradient background of the page and the phone. If the phone had a different color or darker background it would stand out a lot more and make the page feel a little bit less washed out.
Also, the use of whitespace is somewhat unbalanced. Look up white space theory if you want to learn more.
What's the weather little things too that would help, but I don't want to be overly critical. The toughest thing about design is that you'll never think you're designs are good enough.
Best web design company / agency
Top notch and best typically don't coincide with a limited budget.
You might consider a top tier freelancer/consultant though. Less than an agency and still ticks your boxes. With a tight timeline you're also more likely to be able to continue work over the weekends than you would with an agency.
Boss wants to hire a third party to do an SEO audit
Depends on the third-party, unfortunately a lot do just run a report with ScreamingFrog and similar tools. When someone wants a scan I'll provide it, but I make it clear it's just a scam and I help determine what's most important and worth doing.
I do SEO audits/reviews but it's not a scan. I start by figuring out the keywords that are most valuable to rank for, which sometimes a business knows already. If they do, I still evaluate and determine if there are better or more valuable variations. Then I evaluate the site and it's landing pages against those compared to competition currently ranking higher in search. From there I determine what would be needed to beat those results, and I document a plan for doing it.
The output I provide includes specific tactical things that can be done to improve search ranking for the target keywords. I don't know if this is in line with what other firms do, but it makes sense to me.
kevinleary.net/services/seo/ if you're interested.
WTF is wrong with Azure???
Dollars to euros, they've shown you the price in euros but you're reading it as if it's dollars. It's correct.
Assuming it could be done, what would you like out of a JS version of WordPress?
Personally I think a redux of WordPress should be about functionality not making everything JS. We'd be better off with a JS powered CMS that follows similar patterns to WordPress, and maybe has a good migration tool to help migrate from the current WP.
Did bigquery save your company money?
I've seen it go both ways, entirely depends on what the on-site data and cost associated is like currently. Put another way, its highly subjective. Unfortunately rarely does anyone truly ask and answer this question. In many cases I wouldnt be surprised if on-prem was cheaper. When the herd chases clouds ...
If you partition data well and use clustering where it makes sense it can make major differences. Data can be set up with partition limitations, which can make a democratization of data as you've described incredibly more cost efficient.
As a lot of other people have said, storage is cheap querying is expensive. Generating efficient tables for specific queries can also pay off quite a bit.
Constructively criticize my CV, please.
I guess I see a lot that's strange, and its very obvious to me that this os a GPT generates resume.
Does ranking on yandex matter? I'd expect Google.
Advertisements don't increase budget, they increase revenue
Multilingual functionality broadening accessibility is a misuse of the term accessibility, especially in terms of web development
VPS and nginx has nothing to do with robust and secure deployments
"Helping doctors achieve top rankings in national rewards" - seems misplaced, review sites wouldn't normally give out awards right?
I could say more, but generally speaking I like to see real examples of live site I can visit, that look/feel like a high quality product.
AI Won't Replace Us Developers Yet (A Humble Reality Check)
Alternative viewpoint on this: if you don't know how a system is coded, you'd have a hard time putting together anything beyond one-off code. AI can provide single minded solutions well right now, but architecting anything reasonably like an application buckles and you find yourself diagnosing issues for code you didn't write. That generally takes a good amount of added time.
I don't want to be naive though, this is just where we're at today.
What do you do in your documentation to improve user experience?
Absolutely!
I cringe whenever I hear someone say it's easier to avoid added systems and "just update it when we make changes".
When documentation is out of date you never trust it again, not fully.
Is this still valid for frontend devs who are not designers?
Hah, my opinion would be that what really matters is attention to detail. Ask any very (very) talented designer if they'd rather work with a frontend developer who knows design pretty well, or a frontend developer that has an exceptional attention to detail.
Seeking modern, clean and beautiful open-source UI kits without Node or JS frameworks
Your head's in the right place; minimal development without frameworks is more powerful these days than most devs realize.
https://milligram.io/ https://pure-css.github.io/ https://bulma.io http://getskeleton.com/ https://vanillaframework.io/ https://picocss.com https://sprucecss.com/
Of these I like milligram purely based on aesthetics
How to solve "cannot decode raw data" problem?
Check if anything in your code, htaccess or nginx config is setting an Accept-Encoding HTTP header, and if it is try removing it. That was the solution I mentioned here that worked for a similar situation.
You can also use this to check if Gzip is enabled:
I s this possible in wordpress
Web components and well optimized modules can isolate those resources, and it is possible to load and unload client-side assets too if memory is an issue. In web app development it's called an SPA, or single page app. It's what frameworks like Angular, Vue and React are built for. Lots of web apps are built this way.
Try mentioning Vue or SPA to your ai chats and see if it's any better.
Dynamic Subdomains Question : variable.mydomain.com
Here's a pretty solid basic demo:
https://gist.github.com/Kevinlearynet/cb4b4bbde7a41560b0756aa6de69e6d6
Static failover
These work but only if you don't have any POST requests at all on the site.
Once you do get a static copy setup CloudFlare's load balancer has a nice failover setup you can use to configure your primary hosting as the main source and a secondary hosting or backup server as a failover. When the primary goes down, DNS routing will switch to the backup.
Is it recommended to use Elementor for blogs instead of Gutenberg?
It really depends on how you structure your blogs, I personally use a super basic markdown only editor. I can write fast, and it covers all of the formatting I need. It may be a terrible option on a different kind of site, but for me it's perfect.
WooPayments: Urgent Card testing email
It's unfortunately common, it happens when someone gets hold of a lost lf credit cards maliciously and then they use your check out process to see which ones are still active and which are not. I've seen it happen with Stripe and what you see inside of their dashboard is rapid transactions with many failing.
Print shop quoting plugin
Gravity Forms has a calculation add-on that can be used to create a price based on conditional form selections. That can be used to create a custom pricing estimation form, I once used this approach to create a supply ordering form for internal use for a somewhat large a restaurant chain. Any location could login and use it to re-order menus/tables/chairs and almost 100 other things that were all franchised supplies. After selections were made a price quote would be provided, and the manager would enter their signature before submitting the order to their corporate office. It worked well.
I s this possible in wordpress
It's possible on any website and is done with JavaScript using the pushState and replaceState APIs. They allow you to change the URL without a page refresh.
Dynamic Subdomains Question : variable.mydomain.com
You'd need your own server stack and an understanding of advanced DNS to really do this.
One suggestion: don't do it, use a custom URL route instead like domain.com/q/tesla/. It's technically simpler to handle, but the main reason is SEO, if you use subdomains it's not nearly as good for building up domain reputation.
Why is my logo blurry in my header
This should do it in the best way: install Safe SVG, then use the SVG. SVG is a vector graphic, so there's absolutely no possibility of blur at any size.
Today I said goodbye to Jetpack and Pressable
Bloat? From managed WordPress hosting? You get more when you install a single plugin, anything added by managed WP hosting should make it much faster and easier to work with.
I suppose it depends on the managed host though, Pressable has been trying to sell me on recommending the host for years now. But I still haven't ever used it,so maybe there's some bloat there somehow.
Web Form Drop Down Fields
A wizard is a form that's question by question, here's a good example:
https://www.lemonade.com/onboarding/1
9 separate radios wouldn't really work well though.
AI to help speed up the build process
I don't think there's any clean way with Elementor, but there is an official webflow plugin that lets you serve webflow pages right in WP:
When will WordPress have a dashboard that doesn't lack everything. Recommendations for the dashboard are welcome
No argument there, and no shortage of questions like this regarding many things in WordPress:
Why does every site have support for emoji's, but there's no built-in SEO?
Why has the custom fields UI never been changed for improvement?
No clue my friend
Putting code in functions.php vs using a code snippet plugin
Nope, but that's a really good separate point to mention too.
I'm talking about fatal errors that will break a site either way. They would also show up in the error log too, but that would happen with WP_DEBUG set to either true or false.
As an example, let's say someone did something like this:
function fix_my_problems() { // code here } v
That added "v" after the function isn't valid PHP I will trigger a fatal error. the page won't load and you'll see a big ugly error.
Putting code in functions.php vs using a code snippet plugin
If you don't know how to code, use the plugin.
If you do code, absolutely use functions.php or a custom plugin.
Here's why:
When you know how to code it's a PITA to have code in the WP database because diagnosing issues in the future will be very difficult to trace back to it. I very much dislike inheriting a site where this has been going on, whether it's PHP or CSS/JS being injected into a page.
But if you don't know how to code and you try dropping code right into the editor inside the WordPress admin UI it could break the site if there're any syntax errors. if you're relying on that code editor in WordPress to modify the PHP you'll find yourself unable to fix that error. you'll need to connect with FTP and solve it that way which for non-technical people might be tricky.
Also, if you're not a coder it's safer to use the plug-in because it won't allow the syntax errors to begin with, if it's a half decent one.
How is that even possible
Only english sorry, but the image needs to be optimized.
Here's an example:
Big and slow: https://www.nasa.gov/wp-content/uploads/2023/11/webb-stsci-01hf7p3b6pw5ds5n9m9xd1ey27.png?w=1536
Small and fast: https://wsrv.nl/?url=https://www.nasa.gov/wp-content/uploads/2023/11/webb-stsci-01hf7p3b6pw5ds5n9m9xd1ey27.png&output=webp&w=1000
wsrv.nl can do it for any image if you want a good way to do this.
When will WordPress have a dashboard that doesn't lack everything. Recommendations for the dashboard are welcome
Well, you can totally change everything that's on it with custom widgets if you want. I've replaced the whole thing with a BigQuery powered performance view a few times, I can't even remember what was there before. Certainly didn't lose anything needed.
I once worked with a guy who swapped one of the useless WordPress News headlines that nobody reads. He put in a title that said something like "President Putin embraces open-source for a better tomorrow." Nobody noticed for a very, very long time.
Web Form Drop Down Fields
Give radio buttons a try instead, sometimes the ability for people to see all the options at once does the trick.
The next level would be using a wizard flow.
AI to help speed up the build process
Have you looked at the native Webflow integration with Figma? That's pretty good stuff, though not WordPress.
Is Bricks page builder wworth it?
The markup alone is worth it in my opinion, god what a difference compared to Elementor. Very refreshing, plus theres a lifetime license right now, cant go wrong with that.
Some WordPress database queries
Since you're a DBA I'll share this: I do it often too. Usually I replace the entire dashboard of the admin with a performance view for a client. Sometimes I use a connection to the BigQuery API for pulling data into a custom DB table with a CRON.
People are always stunned when they see it, they often think you need BI tools like Tableau just to make a simple visual display of business metrics. Definitely not the case. The most recent one I did showed customer acquisition costs across all of a companies paid ad providers (TikTok/Facebook/Google Ads/LinkedIn). Airbyte handles the ETL to BigQuery, making it fully automated and always pretty up to date.
Graphic designer inheriting a MESSY website that's TOO LARGE to back-up. Crazy huge cache, or something else?
The other thing about backup plugins is that the backup relies on the very system its backing up. If you're not a dev and your site breaks for some reason, and you need to login to WordPress to rollback to a previous backup to correct it... well, what if you can't login?
Could also be media uploads as well
CSS problem styling buttons
Sorry, it's something I could easily do in the dev console if I knew the site and had the buttons available to review.
WPML alternative for better performance
Sure do, wouldn't recommend it if I hadn't. I've worked on various sites that use both. WPML is a very hacked together code base that has a lot of problems, and you'll find yourself referencing a manual quite a lot to figure out how to do things. PolyLang on the other hand is very intuitive, and the code base is much smaller and very minimal as well.
There are other options too, Google translate and other text translators are very good these days. If I were doing this, depending on what you need to translate, I'd consider just adding the Google Translate widget:
https://output.jsbin.com/hakoxiv#
It's accurate, and whenever it's not anyone in another language can pretty easily determine what it means. a common counter argument is that it won't be as good as a manual translation, but for any commerce site it might be worth the trade off because it's completely automated and can support any language with an extremely small implementation that has virtually no overhead. you won't have to publish products in different languages, or manage any extra complexities within your CMS
Is SEO optimization possible on a WordPress site without SEO plugins and theme configuration?
No, it's really not.
And I'm about as minimal a developer as you'll find. SEO is one of only 4 plugins I would always use on a site.
I have a wordpress based personal site like blog. I am creating different kinds of contents but generally in Turkish. Why there are some users from USA? Are they bots?
Highly likely it's bots.
GPTs in learning are extremely likely now.
Wanting to move away from Elementor Pro - what are my options for a basic, quick-loading blog website?
Bricks builder
What’s the best way to build a database site with complex search / filter capability?
You could do it well with WordPress, but you could also make a lot of mistakes that are trouble in the future. I've worked with a few sites like this 4-8 years down the road and every single one of them wants (and really needs) to get out off of WordPress. But it does depend on how its approached. I could build something that does exactly what you want without slapping it together with plugins. If you do use WordPress I'd highly recommend that approach. Here's a good site example I've built that's similar in some ways: puck.news.
Depending on the goals (you mention you're a product manager) it may be worth considering Laravel instead, which is a framework for building SaSS apps. If your company is building a serious product that needs to scale, that's a better approach to consider for many reasons.
Happy to discuss it with you if you'd like, email me if you'd like at info at kevinleary dot net
Some WordPress database queries
I'm not a DBA, but I do know and work with databases quite a bit. I use raw SQL with WordPress all the time, tons of use cases for it.
I don't use the command-line though, I work in SequelAce on my Mac.
The basic reliable plugins to start a project
My starting stack is typically:
Query Monitor (localhost only)
Rank Math SEO
Gravity Forms
Advanced Custom Field Pro
Custom Functionality Plugin
Custom Localhost Plugin - Developer workflow enhancements for my own localhost (disable login, tweak HTTP requests that slow me down, etc.)
You can build a very nice site with that setup as a starting point.
Why does WordPress search function suck?
No index. It's just a database query.
I refuse to be a beta tester for Worpress core updates ever again
Interesting to hear this... I do a lot of work on largish corporate sites and just today has an issue with this oddity:
The addition is strange, it actually stood out to me as the first time in a long time where I can remember experiencing a true breaking change to the frontend of a major site after an update. (site was puck.news)
On a drive home in the car I found myself thinking about a forked version, mentally listing off what I'd remove. It was a longer list than I expected it to be.
Changing domains - sitewide 301 redirect or page-by-page?
I always recommend redirecting page to page, but that doesn't mean you need to have to write hundreds of rules. In fact, you should be able to do it with a single rule and preserve the page path. In terms of SEO its very important.
Also, I highly recommend following Google's guidelines on site moves:
https://developers.google.com/search/docs/crawling-indexing/site-move-with-url-changes
There are steps to take in Search Console that can be very important.
Is Pagespeed insights a waste of time?
The conundrum of SEO: it matters, but how much? I would say you should avoid anything that shows up red, and try to improve that, but otherwise if you're certain the site feels and works fast then I think user experience can outweigh it. If people are coming to your site and staying, especially on mobile, Google will recognize that the speed seems to be less or no issue for the audience. It's my belief that it's not too major, entirely depending on the circumstances.
CSS problem styling buttons
Try adding !important at the end of your overriding rule. If it works, then you have some kind of specificity issue.
Gutenberg blocks are a PITA in many ways, but you can also do this with a theme.json file in the child theme:
{ "$schema": "https://schemas.wp.org/trunk/theme.json", "version": 2, "settings": {}, "styles": { "blocks": { "core/button": { "color": { "background": "#ff5722", "text": "#ffffff" }, "border": { "radius": "5px" } } } } }
Copied this from elsewhere as an example, you'd have to change the border radius with your border color.
CSS problem styling buttons
This is incorrect, his rule should work and in fact it's more specific by not being shorthand.
WPML alternative for better performance
Polylang
Graphic designer inheriting a MESSY website that's TOO LARGE to back-up. Crazy huge cache, or something else?
Yup, sounds like this could be it. Always good to try and use a host with snapshot backups anyhow.
Create a page with background image in wordpress
You sure can bud.
Can't Update Posts
Is there a post or page template set? It could be that the text in the editor isn't actually rendering in the theme template serving it.
If you suspect cache try visiting the page with a query on the end: /my-stubbprn-post/?dhdgaywje
That should force a new cached version of the page, so if you don't see your updates then it's something other than cache.
Finally, double check the slugs match up and make sure you're not editing a copy of the one you're looking at (doubtful, but maybe)
Any way to create a card that visitors can edit?
There's a (very) old school HTML attribute called contenteditable. It makes any HTML editable when clicked, basically turning it into an input field that can change text.
Depending on how complex the editable areas are, this is probably perfect for you.
Editable Headline
Editable paragraph. You can type plain text here.
If it's a one time thing, like you're generating a card for printing or something, then you can use JavaScript to generate a virtual file for download without the need to actually save the text changes to a backend.
I think I first messed around with contenteditable back in '07, I always wondered why it's never seen used for front-end editing in a CMS. Definitely has the potential.
Have to purge cache after every edit to get site to load! help?
Agree with Otto here: if the cache breaks your site every time you publish, turn it off because it's not working.
Looks like wp-optimize uses flat HTML for lage cache, so I had to guess it's a permissions problem with serving those .html files from the server. The error should be in your PHP logs with details you can use.
If you're not comfortable with that maybe try another plugin, this one is pretty good: https://wordpress.org/plugins/wp-fastest-cache/
Any Free "Contact Us" forms?
I feel your pain, it shouldn't be something you have to pay a subscription for.
Option #1
Google Forms, which can feed shbmissions into a Google Sheet
Option #2
Some simple custom code. Here's a very basic one you may be able to work with:
https://gist.github.com/Kevinlearynet/411c6a8432fcc7be2ed7ef3cfff35ea4
You can download that .php, then upload it to your plugins folder. I didn't test this fully though, and it's free, so I'll leave that to you.
Once that's activated as a plugin you can add the form to a rich text editor or shortcode block by entering this:
[basic_contact_form]
Depending on your theme this may not look that rough, but you may also want to add some CSS to it for design.
Somebody forgot to cover their tracks...
In defense of those Automattic dev's:
It's easier to overlook things when you're told to do something you don't believe in.
I can also picture this being a last minute, make-it-happen kind of thing.
That text being part of a .po file may also be a factor too.
How to create "products" automatically in my site with an external API for DUMBS?
In a lot of cases it's actually simpler to avoid WooCommerce, but it depends on what you're actually selling.
People purchase these 10,000+ cards individually, correct? Is it a digital download or am physical product?
If it were me, I'd create a custom system that used paddle.com for eCommerce, and a simple fully automated setup in a custom WordPress theme.
Looking for a business consultant WordPress theme
If you're targeting a high-end audience, the approach will vary:
Enterprise-level solutions: Ideally, you'd want something custom-built with a highly specific combination of messaging and design. This approach works for any type of business but may not be feasible for everyone.
Purchased themes: If a custom build isn’t an option, I’d recommend using Bricks Builder. It’s highly flexible, and many sites built with it showcase a higher level of design compared to typical WordPress themes.
Themes to avoid: Steer clear of "premium" themes from marketplaces like ThemeForest. While popular options like Astra are widely used, I've had numerous business owners seek help with it later due to long-term issues, often finding it cumbersome and restrictive. These themes can lock you into specific tools and workflows, making it difficult to pivot or scale effectively in the future.
$10,000 to Migrate websites from WPEngine to Automattic for Agencies?
Kinsta's agency program pays 10% of all referrals for the lifetime of the account. That's much better than $100, but what's absolutely most important is that Kinsta is a great product I'd recommend either way, referral or no referral.
Did they actually lead with a mention of $10,000 like that?
Advanced Custom Fields alternatives
Need some context, what is it about ACF that doesn't work or is limiting?
Advanced Custom Fields alternatives
Toolset is very inferior in comparison in my opinion.
Development theme that supports Woocommerce?
Storefront is the official theme, I use that myself when it comes up and I'm very familiar with Sage.
Auto-login and redirect after user registration
This a good way I'd go about doing it too
Form to PDF - Generate PDF
I did some detailed work generating PDFs for The World Bank in 2021 to distribute COVID-19 PDFs with charts, graphs, visuals and complex layouts (for a PDF). During the project we explored lots of approaches, here's what I found:
wkhtmltopdf is very good
Puppeteer print and save as PDF is also good, but harder to automate in useful ways
Migrating Databases/Custom Post Types
Usually it's faster to create those custom post types with code, faster loading. If you can export them as code from JetEngine and just use the code I'd recommend giving it a try.
Which has the better performance, Bricks or Spectra?
Just a preference, it's not bad for performance but it's not really flexible in realistic ways that most websites would actually want to create copy with.
How do I shrink the height of standard wordpress search bar?
The concept can work, but its not an exact drop-in fix
Andy Fragen – WordPress on Hiatus
Sure am, very wrong. Sorry about that. This threw me off:
https://ma.tt/2024/09/are-investors-bad/
That mention at the bottom was fudged and included in the meta description.
Can you use Shopify on Wordpress sites?
For this site it was pretty simple and used the buy button, but there was another product based business I setup in a similar but different way like what you've described with a Buy Button that had an inline checkout/cart enabled. It would slide out a cart drawer UI in the WordPress site, then checkout would bring people over to Shopify. A custom Products post type had an option to choose a Shopify product from a dropdown input.
At the time this wasn't available, but if it had been I'd probably have explored it:
Do I need to replace my current classic theme to a newer classic theme and/or block theme?
The only correct answer is to do what's right for you're specific site/content.
My site has been running on the same custom theme since 2012: kevinleary.net, but I wouldn't consider it out of date in any way. As things change I'll change here and there to adjust, but what I have does exactly what I need and has for some time.
Which files & folders to copy when migrating/cloning?
Typically it's everything in the /wp-content/ folder, but it depends on the install and site. If you have a relatively clean and simple install, which it looks like you do, then I think it's like that this is the case.
How to create "products" automatically in my site with an external API for DUMBS?
Professional approach would be to:
- Add a custom database table to your install with a schema specific for those cards
- Create a WP cron scheduled task that makes the API call routinely every X days, or add a dashboard widget with an "Update Cards" or "Sync Cards" button that can be used on-demand as needed
- Query that database table with $wpdb to get your cards
This has many advantages over a hack job develop-with-a-plugin approach:
- 10,000 records are going to query like lightning compared to any other approach
- Storing these cards in a separate table will keep the rest of your site very fast and lean, much faster than if they were added as a custom post type or wp_options values
- Everything I just mentioned can be done in a single PHP class, with no added overhead
When you use WordPress like a web development framework it's a whole different beast. I do a very similar process for handling ZIP code lookups of city, state and country. I pull in thousands of records from BigQuery public data (US census) on-demand and store it in a custom table like this. Then I have a frontend in the theme query those via an API. Typically I do this with Vue and a custom JSON API I create specifically for the task. WP-JSON is too clunky and slow for use cases in comparison.
How do I get my website to load when "www." is added to the web address?
Lots of technical answers here, but I think based on the question it may be useful to clarify a few things:
- WordPress doesn't redirect www to non-www, you control this when you provide the site address during install
- To host your site on www you need to change this site url value, which is found under Settings in the admin area
- BUT, it's not as simple as changing it and saving. All of the non-www URLs in your WordPress sites database need to be replaced with an updated www url. To do this you'll need to either use the WP CLI search-replace command, or use a search and replace database plugin.
- Once the site has been updated to work on www as the site url you can then make the DNS updates mentioned here
There are professional ways to do this with no downtime, but it's a little more complex to explain here.
Newbie Question: Gutenberg, Kadence or Breakdance?
None: Bricks
How would YOU improve Wordpress?
Existing things I'd change:
- Say goodbye to Hello Dolly
- Serializing things for the database sucks big time, use JSON instead
- Database schema: custom post types, media uploads, menu items, and more should be in different tables similar to Laravel, with cleaner relationships
- The current site URL should be set in one place, then referenced throughout the site with either relative or templated URLs - making it so much easier to move from local to staging to live URLs.
- Database migrations like Laravel for modern devops (probably just my own selfish want)
- Don't make so many generalized assumptions about all the crap you think people want, and instead make it available as extras: emoji's, feeds, xml-rpc, json api, gravatars, post tags, theme customizer, sidebar widgets, and much more. I think it's reasonable to say that standard SEO management and a better custom fields UI out of the box is more practical
- Simple the API and use GraphQL or at least something easier to work with
- Avoid incremental IDs for posts somehow, not sure of the best way here but it should avoid the PITA aspects of syncing between to installs. Common case is when you copy a site to prepare for launch, then your client publishes a dozen or so posts in the gap between then and launching.That XML import export process doesn't cut it anymore. A proper way to handle this maybe with JSON would be good
- Don't generate multiple image sizes as different files, use a dynamic resizer with an API pattern like libvips
- Use a proper .env instead of wp-config.php
- Use git exclusively for contributions and ditch SVN for plugins
- Usermeta table would benefit from a tighter, more optimized schema/API for adding custom user fields
- Use a JSON spec for string translation, .po files are a PITA to work with
- Offload some of what's currently in wp_options to optionally be in a .env file instead
Built-in features that make sense:
- Built-in basic SEO management
- Field management for custom fields (ACF functionality)
- Site health should have a plugin performance analysis tool
- Multifactor authentication (basic)
- Form builder (like Gravity Forms)
Overall approaches worth considering:
- Future features/enhancements should be things that 80% of websites will use if built-in
- Specialized stuff less likely to be used should be available as add ons for those that need/want it
- Use the plugin ecosystem as a voting system for future features to add
How would YOU improve Wordpress?
Existing things I'd change:
- Say goodbye to Hello Dolly
- Serializing things for the database sucks big time, use JSON instead
- Database schema: custom post types, media uploads, menu items, and more should be in different tables similar to Laravel, with cleaner relationships
- The current site URL should be set in one place, then referenced throughout the site with either relative or templated URLs - making it so much easier to move from local to staging to live URLs.
- Database migrations like Laravel for modern devops (probably just my own selfish want)
- Don't make so many generalized assumptions about all the crap you think people want, and instead make it available as extras: emoji's, feeds, xml-rpc, json api, gravatars, post tags, theme customizer, sidebar widgets, and much more. I think it's reasonable to say that standard SEO management and a better custom fields UI out of the box is more practical
- Simple the API and use GraphQL or at least something easier to work with
- Avoid incremental IDs for posts somehow, not sure of the best way here but it should avoid the PITA aspects of syncing between to installs. Common case is when you copy a site to prepare for launch, then your client publishes a dozen or so posts in the gap between then and launching.That XML import export process doesn't cut it anymore. A proper way to handle this maybe with JSON would be good
- Don't generate multiple image sizes as different files, use a dynamic resizer with an API pattern like libvips
- Use a proper .env instead of wp-config.php
- Use git exclusively for contributions and ditch SVN for plugins
- Usermeta table would benefit from a tighter, more optimized schema/API for adding custom user fields
- Use a JSON spec for string translation, .po files are a PITA to work with
- Offload some of what's currently in wp_options to optionally be in a .env file instead
Built-in features that make sense:
- Built-in basic SEO management
- Field management for custom fields (ACF functionality)
- Site health should have a plugin performance analysis tool
- Multifactor authentication (basic)
- Form builder (like Gravity Forms)
Overall approaches worth considering:
- Future features/enhancements should be things that 80% of websites will use if built-in
- Specialized stuff less likely to be used should be available as add ons for those that need/want it
- Use the plugin ecosystem as a voting system for future features to add
For those handling multiple WordPress projects, how are you managing client requests for custom features without sacrificing site speed?
First determine if there is a way to provide the functionality in your theme's functions.php file, or from a functionality plugin you create. In many cases a customization or specific adjustment can be made with very few lines of code, compared to potentially tens of thousands of more if you pull in a plugin.
When you do use a plugin for something, try to find one that is as close to handling that use case specifically, withas little extras you don't need beyond that.
99% of the garbage sites I've inherited with performance issues have plugins to blame.
Final thought: be brutally honest with youraelf about what your client is asking for, and force yourself to creatively think about the problem from the context of your client. I've had many situations where a little creative thinking goes a long way and helps me find a very simple, maintainable solution that may be alternative - but if it's really effective for that situation it could be ideal.
I don't get it. What problem does Bricks solve?
Elementor, Gutenberg, Beaver Builder, And pretty much every other page builder option drive developers nuts because they're the opposite of "DRY" (don't repeat yourself).
Page builders approach design on a page by page basis, allowing clients to completely butcher a professional design. If you want to preserve a consistent brand your content management should really allow you to separate the design from the content. while Bricks doesn't do this 100%, it's much closer than any other option.
it also creates markup that's easy to understand and work with as a developer. Elementor's markup is God awful, And when you try to override elements with custom CSS for specific instances it quickly becomes a nightmarish scenario.
Long winded way of saying: if you know how to code, the benefits should be obvious.
Using speech to text here, probably some spelling errors and whatnot.
Done with builders
Using a page builder would be like building a house really fast, that's not half bad, but doing it with a totally unique measuring system (not metric or imperial).
You'll have a house that you may like today, and you'll be done quickly, but when it comes time to fix something, or renovate anything, you'll have to use that non-standard measurement system. Anything outside of it and you need to tear that house down and rebuild it. You'll also be very limited in the tools and supplies that are available to fix and change things
A custom theme is like a custom built craftsman house, it's exactly what you want, is classically beautiful with a design that should last much longer, and over the years you can renovate and modify as needed to keep it looking great. But if you build something funky that's out of the box, you may find yourself in a tight spot in the future. If you use a builder that doesn't provide good recommendations about such things along the way.
How can I translate "read more" buttons? (Posts archives by Tag and by Date)
The built-in string translation approach is preferred, but sometimes that's tough to work with if you need to create a .po translation.
This isn't the recommended approach, but it does provide a simple and direct way to change the "Read More" text with a translated version based on the currently selected language option in WP user settings:
function custom_read_more_text($more) {
// Check the current language
$current_language = get_locale();
// Set "Read More" text based on the language
if ($current_language == 'es_ES') { // For Spanish (Spain)
return ' <a class="more-link" href="' . get_permalink() . '">Leer Más</a>';
} elseif ($current_language == 'en_US') { // For English (United States)
return ' <a class="more-link" href="' . get_permalink() . '">Read More</a>';
} else {
// Default fallback in case of other languages
return ' <a class="more-link" href="' . get_permalink() . '">Read More</a>';
}
}
add_filter('excerpt_more', 'custom_read_more_text'); Should I create a wordpress site or not?
I wouldn't let any of this deter a new build, truly from a business perspective.
WP is too big to fail, so many others are investments on it that a solution to any problem will be provided. Even with this drama, it still has the least risk.
Let the problems begin with "SCF". I'm using the new SCF instead of ACF and I already have issues with it.
There's a reason Automattic doesn't have a single popular plugin in the directory...
Open letter to Matt Mullenweg
What bothers me most about this is the fact that it's advanced custom fields he chose to target. That was wrong, and very disrespectful for so many reasons.
I believe Advanced Custom Fields has played a significant, critical role in making WordPress the most popular CMS in the world. It's no coincidence that WordPress usage as a CMS skyrocketed after its release in 2011. I believe it was close to 13% of market share as a CMS at that point.
I was an early pioneer of using meta boxes with custom form fields that enhanced the UI of custom fields. ACF revolutionized this approach, and it led to a rapid widespread adoption of WP as a CMS for businesses.
To takeover this plugin, which has been so crucial to the very success of WordPress, is just so disrespectful. Particularly if you know and have worked with Elliot on anything.
Here's some supporting evidence of the correlation between WordPress market share and ACF:
API returning malformed JSON
Glad it helped, usually it would go in the header.php file of a theme.
How to Automate Gold Price Updates and Display Daily Charts in WordPress?
Here's a public API with the current gold price:
https://data-asg.goldprice.org/dbXRates/USD
You could use wp_remote_get() to get the price from there, save it with the transients API to cache the results for 15 mins to avoid abusing the API.
Only use this for a private plugin though, if you're releasing a public one you definitely would need to create your own API.
Redirecting to external website
Needs to be a full URL including https:// at the beginning in the "To" field
How to structure a second location site.
It's possible to power multiple domains with one single WordPress install (without MU) using an nginx proxy. You need 3 hosts for two sites, one for the admin and the other two public facing. It's also a good way to secure a WP install.
Is there a reason wordpress core needs to be endlessly updated?
If it bothers you and you have a good host, and a stable site, you can enable automatic upgrades for the core.
Help Needed: Best Solution to Translate WordPress Websites
Polylang gets my vote.
Definitely never use WPML.
WP Neophyte Desperately Needs Help
Struggle through it by learning, or hire a developer.
"Click to use" cupon
A custom plugin could do it, here's a rough idea that should work:
- Coupon created: adds a database row to a custom table with columns for any data you'd need related to the coupon and also a unique hash and a "used" column thats a true/false boolean. Also a reference to the user account for the customer.
- Generate a QR code for the coupon using the hash and display it in your app. Check to make sure their account doesn't already have a used coupon in the database table.
- When a customer clicks the USE button your discounts are applied and the recording of the DB table is updated to mark it as used.
Transferring to Wordpress
Google Search Console will give you the current organic search traffic performance. After making the switch, it can be used to monitor for errors and issues so that you can fix anything that is a problem.
Never worked with surge.sh, but I have done migrations from other static site generators like Hugo to WordPress. If there are a lot of pages then a migration script is really needed. I'd first look for an official way to do it with tools from either surge.sh or a WP plugin specifically for surge.sh, but I think you'll need to create one.
It's dev work, but a CLI script to create a post or page for each static page file would do it well. file_get_contents() to read each static file, then wp_update_post or wp_create_post to generate a WP post or page.
Which has the better performance, Bricks or Spectra?
I believe the answer is Bricks.
Spectra has more JS loading in that can slow things down, and also tends to make more database queries.
Beyond just performance, not using Gutenberg is a major benefit in my opinion.
Elementor + Woocommerce are really resource hungry
They sure are, that's the price paid for a system that is meant to handle a broad set of use cases for millions of people.
It's also the reason developers prefer custom code. Whenever I hear some say that WordPress is slow it's not WP at all - it's plugins like these.
How do I shrink the height of standard wordpress search bar?
I can't test this from a phone, but this should work:
body .wp-block-search__inside-wrapper {
height: 40px !important;
}
body .wp-block-search__inside-wrapper input.wp-block-search__input {
height: 40px !important;
line-height: 40px;
padding-top: 0;
padding-bottom: 0;
box-sizing: border-box;
} Substack-like subscriber plugin?
Called a "modal" in web developer/UI terminology. You'd just need to find a way to add your form to one and you'll be good.
Not a fan of these plugins, but I've seen people do this with:
- Popup Maker
- OptinMonster
API returning malformed JSON
There's a plugin loading GA tag. Since you're a developer:
Search the entire /wp-content/ folder for files containing that HTML comment. If it's in a file under the /themes/ directory you can edit it and remove the comments yourself.
If it's under plugins, which I think it will be, you may need to replace the plugin that's doing it. I usually do this directly in the theme's header.php, you really don't need a theme at all.
Just took over a site supposedly using elementor pro
In this scenario I'd usually have the client pay for a new Pro license that they own, then set it up for them. That way you solve it for good for them.
Plugin to have a page with list of categories, subcategories and links to related posts?
Drop this in your theme's functions.php file and it will give you this as a short code: [category-posts-list]
It outputs a nested ordered list that you could style anyway you want, but it won't be efficient on a site with a lot of posts. If that's your situation then transients would be needed for caching it.
/**
* Category Posts List Shortcode
*
* This shortcode generates an unordered list of all categories,
* with each category containing a nested list of links to all posts
* within that category.
*
* Usage: [category-posts-list]
*
* @return string The HTML output for the category and post list.
*/
function category_posts_list_shortcode() {
ob_start();
$categories = get_categories();
echo '<ul>';
foreach ( $categories as $category ) {
echo '<li>' . esc_html( $category->name );
$posts = get_posts( array(
'category' => $category->term_id,
'posts_per_page' => -1,
) );
if ( $posts ) {
echo '<ul>';
foreach ( $posts as $post ) {
echo '<li><a href="' . get_permalink( $post->ID ) . '">' . esc_html( $post->post_title ) . '</a></li>';
}
echo '</ul>';
}
echo '</li>';
}
echo '</ul>';
return ob_get_clean();
}
add_shortcode( 'category-posts-list', 'category_posts_list_shortcode' ); How to have one WordPress Dashboard managing two subdomains?
WPMU is not your only option, and honestly it's not something I recommend using. It's too much overhead.
I did this for TripAdvisor in the past, unfortunately it's not online anymore (but was for 9 years). We had a single WP install hosted at WPEngine with 9 different domains pointed to it for different locales:
TripAdvisor.com TripAdvisor.de TripAdvisor.es TripAdvisor.it
Each domain was setup to point to the site with an nginx proxy, and the main site was hosted at TripAdvisor.wpengine.com. Each proxy had a few rules in place to replace the WPEngine.com domain with the current host, but in general the model was to have one domain used as the admin, and all other serve a variable frontend.
Some people may call this complex, but the end result was significantly easier to work with than an MU install.
Can Someone Explain the Advantages of Elementor vs. Custom Development?
For your situation I believe you're right, Elementor is overkill. I think unfortunately many people who claim to be a "WordPress developer" don't actually know all that much code. So it may be much faster for them specifically.
I do think Elementor is good for situations where a business owner wants the ability to create things on their own, directly, and they're technically inclined to do so. Only for a small number of pages though, anything over 100 and the site starts to slow down (usually)
A good example of Elementor in action like this is cred.ai. That awesome homepage design was created by one of the founders directly, because he's a very talented designer, is highly technical, and had a very specific vision he wanted to build. Building something like that with an agency and a classic custom theme would take significantly more time and cost to do.
Why Are Developers Obsessed with Custom Code in WordPress?
A few reasons, many already said but listed anyways:
1 Performance for high traffic sites
Plugins are the #1 cause of a slow WordPress site, by far. When you have a high volume site, especially one with a lot of logged in users, it doesn't cut it.
2 Reliability: things don't break... ever. (if you're good)
I built a custom theme for TripAdvisor in 2014 that remained online and in-use till the end of 2023. For those 9 years it didn't have a single issue caused by a plugin or core update.
3: Precise branding/design + supporting redesigns
The TripAdvisor Blog I mentioned is a good example. They had very specific branding guidelines that were followed, with consistent whitespace/fonts/colors/etc. The only sane way to do that across thousands of articles is with a modular approach using patterns a developer uses. This theme went through 3 separate rebrands, and each one was actually a very small amount of work because it was built this way.
4: Plugins are built for mass audience
Plugins are built for a mass audience, so they have to cover many scenarios. Custom code solves a specific problem, so it can be much more precise and lightweight. A good example would be a subscription based business building eCommerce. You could do this with WooCommerce, but it would be a major problem in so many ways. (living examples: puck.news)
What do I need to know to develop a custom WordPress theme?
There's definitely lots out there covering this, but I've heard this question asked here and elsewhere enough to know that something's missing. I think reviewing a super simple, bare bones custom theme might be an ideal starting point. I set one up for this specific purpose:
https://github.com/Kevinlearynet/basic-wp
That's a build of the absolute simplest custom WordPress theme. Poke around and you should be able to get a feel for what's going one without being too overwhelmed.
What do professional Wordpress developers use to create sites?
I've been working with WordPress for a long time, including some big sites for well known organizations. I've also inherited many sites built by high end agencies, and I've seen these specific approaches used a lot.
Professional WordPress developers build out a custom WordPress site with one of the following methods, in order of commonality:
- ACF (advanced custom fields) combined with custom page templates, post types and taxonomies - an old, well know, powerful approach.
- Gutenberg (not me) with custom JS blocks (crazy purists) or ACF (advanced custom fields) for creating blocks with CMS fields for customization
- Bricks as a page builder, but not Elementor or any other page builder
To do any three of these approaches well you really need programming/coding skills though, that's kind of what makes them professional.
Convert TIME to INT in BigQuery
Instead of the CAST use this:
TIME_TO_SEC(ride_length) AS ride_length
To convert a TIME to seconds.
I've done this a few times to build restaurant locators, and dealer locators. The best approach I came up with used a calculation recommended for use with short distances by a Caltech professors and NASA engineer (Bob Chamberlain)
function haversineDistance($lat1, $lon1, $lat2, $lon2) {
// Convert degrees to radians
$lat1 = deg2rad($lat1);
$lon1 = deg2rad($lon1);
$lat2 = deg2rad($lat2);
$lon2 = deg2rad($lon2);
// Haversine formula
$dlat = $lat2 - $lat1;
$dlon = $lon2 - $lon1;
$a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlon / 2) * sin($dlon / 2);
$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
// Distance
$distance = 6371 * $c;
return $distance;
}
// Example usage
$lat1 = 42.3601; // Latitude of point 1
$lon1 = -71.0589; // Longitude of point 1
$lat2 = 40.7128; // Latitude of point 2
$lon2 = -74.0060; // Longitude of point 2
$distance = haversineDistance($lat1, $lon1, $lat2, $lon2);
echo "The distance is: " . $distance . " km";
The equation this is based on in JavaScript:
dlon = lon2 - lon1
dlat = lat2 - lat1
a = (sin(dlat/2))^2 + cos(lat1) * cos(lat2) * (sin(dlon/2))^2
c = 2 * atan2( sqrt(a), sqrt(1-a) )
d = R * c (where R is the radius of the Earth)
This nice little tool documents the general concept well, and provides an easy way to test it out:
How to solve "cannot decode raw data" problem?
Ran into this myself, it was caused by setting the "Content-Encoding" value to gzip/deflate/br for compression. Removing that header entirely solved it, and we ended up compressing with CloudFlare w/o issues.
Pushing Extracted Data into BigQuery Cannot Convert df to Parquet
100% agree, complete waste of time. It's surprising to me that a big data platform would base an auto schema off the first 500 rows.
JSON newline is another option that works well if you're using an API approach. It's tedious to set up, but at least os reliable and easy to understand when things go wrong. I've done it with PHP and Python.
Get the number of organic search users and sessions for a channel group in GA4 in BigQuery
Not sure about the channel group part, but here's how you can get organic users and organic sessions that match closely to the GA4 UI's values:
SELECT
COUNT(DISTINCT CONCAT(user_pseudo_id, (
SELECT VALUE.int_value
FROM UNNEST (event_params)
WHERE KEY='ga_session_id'
AND traffic_source.medium LIKE '%organic%'))) AS organic_sessions,
COUNT(DISTINCT IF(
traffic_source.medium LIKE '%organic%',
user_pseudo_id,
NULL
)) AS organic_users
FROM
`project.analytics_{PROFILE-ID}.events_*`
What is an ideal approach for increasing wordpress site speed?
I use hooks to filter images so that they're served through wsrv.nl. This allows me to remove year/month based folders, and avoid sizing multiple copies so it saves a lot of storage space.
As an example, this NASA image is 1.9mb at 4k resolution:
https://www.nasa.gov/wp-content/uploads/2023/06/jwst-flickr-52259221868-30e1c78f0c-4k.jpg
When I pass it through wsrv.nl it's reduced to a 310kb WebP:
The optimized version is still great quality and high resolution.
If you really want a plugin then EWWW Image Optimizer is a good one:
https://wordpress.org/plugins/ewww-image-optimizer/
This will compress and optimize images as people upload them, but I don't believe it will convert to WebP.
How to BigQuery json "struct" to rows?
BigQuery actually has a JSON data type that may be better than a STRUCT:
WITH example AS (
SELECT '{"AED":3.6725,"AFN":94.0551,"ALL":107.9775,"AMD":480.2637,"ANG":1.79,"AOA":590.8707}' AS json_str
)
SELECT
CAST(json_str AS JSON) AS json_object
FROM example;
https://cloud.google.com/bigquery/docs/json-data
But if you want a struct type specifically it could be done like this:
WITH example AS (
SELECT '{"AED":3.6725,"AFN":94.0551,"ALL":107.9775,"AMD":480.2637,"ANG":1.79,"AOA":590.8707}' AS json_str
)
SELECT
CAST(
(
SELECT AS STRUCT
CAST(JSON_VALUE(json_str, '$.AED') AS FLOAT64) AS AED,
CAST(JSON_VALUE(json_str, '$.AFN') AS FLOAT64) AS AFN,
CAST(JSON_VALUE(json_str, '$.ALL') AS FLOAT64) AS ALL,
CAST(JSON_VALUE(json_str, '$.AMD') AS FLOAT64) AS AMD,
CAST(JSON_VALUE(json_str, '$.ANG') AS FLOAT64) AS ANG,
CAST(JSON_VALUE(json_str, '$.AOA') AS FLOAT64) AS AOA
) AS STRUCT<AED FLOAT64, AFN FLOAT64, ALL FLOAT64, AMD FLOAT64, ANG FLOAT64, AOA FLOAT64>
) AS currency_struct
FROM example;
Search a specific pattern using regex in bigquery
I think the RegExp is the problem, trythis pattern instead:
[^\d](\d{2}[A-Za-z]{2}\d{3})
Here's a full example showing it in action at regex101.
This add a rule to only capture your 7 digit ID after a non-digit character, so you won't pickup those first invalid patterns anymore. Just update your REGEXP_EXTRACT patterns to use it.
When a capture group exists in the pattern only the value matching that will be returned:
If the regular expression contains a capturing group ((...)), and there is a match for that capturing group, that match is returned.
Pushing Extracted Data into BigQuery Cannot Convert df to Parquet
Create a schema with 70 columns that are all strings, import the data there, then create a VIEW that casts those strings to the correct types. BigQuery has plenty of methods for casting that should cover all scenarios you need. If efficiency is a concern use a materialized view.
To do it I've used the API's bulk CSV upload, or I drop CSVs into GCS instead. Then I can set up a native scheduled import in BQ to pull that CSV in on a recurring schedule. One helpful tip: set the CSV to use pipe separators not commas, it makes dealing with any longer message like strings a lot easier. If you want, you can also configure the CSV import to loosely handle errors, skipping them entirely during import.
Any CRM plugins that have an easy to use UI for people who are older?
I think that can be done with the built-in analytics included with WooCommerce:
https://woocommerce.com/document/woocommerce-analytics/customers-report/
Buddyboss: How well does it handle concurrent users?
It makes too many MySQL queries, and with users logged in to use it they're typically all uncached hits that hit the database. As soon as you have a light to moderately used forum it will buckle under pressure. My general thought is that it's better to keep a system like this separate from WordPress, the two together combined with Multisite is just too much.
How to access GCS via SFTP?
Shared web hosting, Dreamhost as an example is $2.59/mo.
Can BigQuery be used for data cleaning, normalization, and/or de-duplication of rows?
But nobody says how to do it...
Create normalized VIEWs that query your table data and clean it up. It's one of the most common uses for views in there.
Duplication can be done with DISTINCT
Normalization with LOWER, REGEXP, COALESCE, CONCAT, CAST, and many other operators
Using BigQuery with Wordpress
You'll need to create a JSON API key using a service account. Technically you'll end up installing the Google Cloud API library, then you'll pass the contents of a .japn key file to instantiate a BigQuery client. It seems complex the first time, but once you get the hang of it it's relatively easy.
https://cloud.google.com/bigquery/docs/samples/bigquery-client-json-credentials
I've done exactly this before, creating an attribution dashboard UI with BQ data inside of the WordPress admin. You'll want to cache those query results, and probably sync up your data behind the scenes with cron to get a snappy UX.
Can't upload .csv file to BigQuery
So BigQuery will basically try and guess the schema and type of every column by looking at the first 500 rows. You can either set it to skip rows with errors, or set your own schema manually. If the data still has issues you get all sorts of errors like this. The best way I've found for advanced CSV imports is Airbyte:
https://docs.airbyte.com/integrations/sources/file
Because it uses Pandas IO tools CSV parser which is highly configurable.
Did I fuck up?
I've seen this happen with some of the newer ETL tools they offer, which are not good. In various cases we've discussed it with Google support and have been refunded. If you reach out immediately or close to the time it occurs it should be fine. Don't take no for an answer though, because I'm pretty certain they can and will refund it if you're honestly in this position. \
But lesson learned, right? Expect the unexpected with cloud data, it can get off the rail like others have mentioned. Stick with it though, it's fun!
Best strategy to implement a bidirectional synchronization pipeline between BigQuery and GitLab/GitHub?
Hearing bi-directional sync makes me think relational DB, not BigQuery.
New to querying
I think GROUP BY is what you're looking for?
select
start_station_id,
sum(tripduration) as total_station_duration
from dataset.table
group by start_station_id
order by total_station_duration desc
i may be misunderstanding though, if you want a count of trip_id's per station just replace the sum(tripduration) with count(distinct trip_id)
Empowering Users with BigQuery: Best Practices for Sharing Access
2 is what I'd usually do. Sometimes it's useful to keep raw ingested tables private, then expose views to your end users/customers. That way you can serve up slimmed downed, renamed, and pretty data structures that are easy for them to work with. You can also exclude ETL related columns and other sensitive stuff.
Date and time searching
Like others have said, TIMESTAMP or TIME is the type you'll need to work with:
SELECT * FROM your_table WHERE TIME(TIMESTAMP(your_timestamp_column)) BETWEEN TIME("11:00:00") AND TIME("23:00:00");
Be sure to normalize timezones though
Moving GA4 dataset to another project
Give a single Google IAM user full access to both projects, then I think you can MERGE the old GA4 table into the new one. It may be tricky with same day partitions, but maybe not.
Report Builder (ssrs) parameterized Query
I don't fully understand SSRS, but I took a quick look at .NET docs on it and I would think it should be possible to just generate a dynamic WHERE clause on the reporting side?
But if stored procedures are needed a nice way is with JavaScript/JSON:
CREATE OR REPLACE FUNCTION project.dataset.find_in_json(input_string STRING)
RETURNS STRING
LANGUAGE js AS """
// Example JSON collection (you could retrieve this from a BigQuery table)
const jsonCollection = [
{"key": "apple", "value": "fruit"},
{"key": "carrot", "value": "vegetable"},
{"key": "banana", "value": "fruit"}
];
// Search for the input string in the collection const result = jsonCollection.find(item => item.key === input_string);
// Return the corresponding value or a default message return result ? result.value : 'Not Found'; """;
Is BigQuery absolutely cheaper or relatively cheaper?
Worth noting, if you're pushing data in then reading it for analytics BigQuery is great. But if you want to update your data frequently then a relational database like Postgres may in fact be much more efficient.
Big query issues
If you're familiar with relational SQL like MySQL this may help:
dataset = database
I think the dataset naming is what's confusing here, but generally in BigQuery:
You'll always be querying from a "dataset.table" if the table your pulling from is within your current project
If it's outside your project, then it would be "project.dataset.table"
If you ever see something selected from a table with a , it's a partition: "dataset.table_202408"
Views are just saved queries that look like tables, but there's no underlying data stored.
Laymen's descriptions for sure, but it would have helped me years and years ago when I started out.
Fact table and view performance at run time
Two interesting features that may be worth looking into are:
- Tableau's incremental refresh feature: https://help.tableau.com/current/prep/en-us/prep_incremental_refresh.htm
- Materialized views (maybe) - they can be restrictive but the intended purpose is this use case
- Scheduled queries that append or merge your calculated data into a new table
They're all situational, but in similar circumstances I've used these approaches and they've worked really well. The high level pattern is to only query new data,then cache your computed output.
How to restrict media library grid view to only display files from categories current role has access to
The accepted answer here doesn't work for the image grid, only the list view which few people use. If you want to adjust the number of images per page shown in the Media Library grid view then this the code you want:
add_filter('ajax_query_attachments_args', function ($query) {
$query['posts_per_page'] = 20;
return $query;
}, 11, 1);
That admin screen is generated using JavaScript templates that pull their data from an AJAX request, so adjusting the query used in that AJAX handler is what's needed.
Access local postgres with SequelPro
Github Actions SSH - pseudo-terminal will not be allocated because stdin is not a terminal
You should be able to easily solve this one by adding -T onto the ssh commands in your .yml like this:
run: "ssh -T root@${{ secrets.SSH_HOST }}"
The -T argument will disable pseudo-terminal allocation.
There has been a critical error on this website. Please check your site admin email inbox for
There should also be a PHP error in your server error logs showing you where and what is causing it.
Deploying your own WordPress instance
Those multiple choice answers don't add up.
Git deployment and/or GitHub pipelines to isolate the build process
How to create a wordpress website for tax filing services where customer can the document for particular selected service and customer can register your self and get update from admin he will notiefed and they can see the peogresss
If you're serious about the app I'd consider Laravel not WordPress.
Integrating my React chatbot into WordPress website
I'd usualy do something like this:
https://stackblitz.com/edit/js-gmhwuw?file=index.js,index.html,hello-world.js
But this is worthlooking at:
How do you guys do QA?
For design alignment and consistency I run a Puppeteer script to take full screenshots of desktop and mobile sized viewports for every public facing page in the site, including 404s and other errors. I can review all pages much faster this way.
I also have that same script spit out any JS errors it encounters, which often catch interaction things that are broken when the screenshot might otherwise look good.
For backend work there's unit testing, but also HTTP testing. Sometimes a node script with a series or fetch requests to APIs, or bash and curl, are useful.
How do you guys stick to the website building process?
Based on 16 years doing it:
Break it up into chunks
Print a list of what you need to do at the start of each day or week to complete each chunk
Highlight completed items you go
Most important step: keep a record of how long each chunk actually took and then review and learn for your next estimate
Get a pomodoro tomato timer - this lets you set a timer for 5/10/15/30/60 min increments to help you time boz certain things
Find ways to get better each time
Don't bill fixed price projects, at the very least charge half your hourly rate when you go over. You're incentivized to get it done, but at the same time its way less of a hit than $0/hr.
Remember, all humans are bad at estimating. You can never anticipate everything.
Bad gateway 502 Word press
Hard to say what's causing it, maybe that you're only handling http:// over port 80 and not https://, but as a reference point take a look at the default nginx config here:
And also turn on nginx error logging too:
https://docs.nginx.com/nginx/admin-guide/monitoring/logging/
With a 502 I'd usually look at the logs for errors first.
An odd problem
This is right, inside cPanel look for settings mentioning "Manage Redirection" or "Document Root".
Document root is specifically what folder the domain gets pointed to.
How often do you perform maintenance?
You can actually enable automatic plugin, theme and core updates right within the WordPress config now. ManageWP and all the others aren't really needed. If the plugins you use are generally high quality there shouldn't be issues. But have snapshot backups in place.
Best backup method? Can I save the backup to my own hard drive instead of a cloud?
Daily snapshots handled by your host, outside of WordPress, with an easy to use rollback/revert process.
That beats any plugin in my opinion. Kinsta and WPE are two examples, among a bunch of others.
Taking over website responsibilities but do not know where to start
ChatGPT would be an excellent resource for you I think. Ask it every question you have along the way and learning will be much faster.
What stops all the highly intelligent people with brilliant ideas from starting a company?
Grit, and a strong understanding of what truly matters.
Having great ideas is actually pretty common, we all do at some point. Having the tenacity to turn them into something isn't. In the workplace I think usually its not that other people you work with are smarter, they just know more about the business/product. The best ideas usually come from the people with a fresh perspective, who aren't dug in deep yet.
Also, I've worked with plenty of people who both felt and acted like they were much smarter and more knowledgeable than I was. In my experience people that want you to know they're smart aren't ever the smartest person in the room.
Good books worth reading though:
The Slight Edge Rich Dad, Poor Dad
Any CRM plugins that have an easy to use UI for people who are older?
When you say CRM, are you looking to provide them with a customer profile view that includes a list of all WooCommerce orders they've made?
Have you ever had to cancel a WordPress project because the client was so bad?
Unfortunately this happens with WordPress, there are a lot of steaming piles out there and it's very difficult to inherit one.
You end up spending a lot of mental effort explaining why the house is falling apart, because if you don't you end up sounding like a sleazy mechanic. The ironic thing is that the lack of budget is usually what got them into the situation to begin with: it's cheap and easy to install a plugin for metrics, but it's like not going to the dentist to save money on a cleaning, without thinking about the cavities and crowns you'll end up with.
I've found myself in this position maybe 4-5 times, and every single time I wished I had built a simple, custom theme at day one. Usually it would have cost the customer much less in the end, because they end up endlessly patching the existing setup.
Rather than dropping them maybe consider leveling with them? I'd say that based on past experiences I think the path we're on only leads to more issues, ultimately taking more of my time and costing you more money to do things that should be very simple. In most cases they really didn't know the site was being built haphazardly.
Then I'd pick 2-3 places on their site that are really ridiculous to work with, and show them examples of systems I've built elsewhere that do it much better. It's the light at the end of the tunnel so-to-speak and it backs up what you're saying.
Good luck, know that probably every WordPress developer has been or will be in that situation at some point.
Buddyboss: How well does it handle concurrent users?
Not well. Not well at all, really.
It depends most on the plugins you're relying on, and the theme or page builder your using. For whatever reason every site I've seen using Buddyboss has been a disaster, not to say it can't be efficient, but when you look at the Query Monitor database results it's pretty telling.
Who uses roots.io Wordpress Ecosystem? What are the advantages and disadvantages?
If you don't have logged in members that are hitting the site uncached it provides no benefit. Your page cache will serve a static version of the site after PHP processing, so you're really compiling PHP templates for nothing.
If you do have a membership type site with a decent number of logged in users then maybe it could help.
My honest advice is don't use either for many reasons.
Who uses roots.io Wordpress Ecosystem? What are the advantages and disadvantages?
100% agree.
I've inherited agency built websites that use it, which is maybe where it's useful for establishing common patterns to handle staff rotation.
As a developer the features really just gave me yet another set of documentation to reference and learn, and frankly more difficulty getting things done.
Less code that you can quickly and easily understand is always going to be more valuable.
Largest Contentful Paint
No problem!
Lock down WP
Assuming you have a professional workflow with deployments going on:
- Look into the wp-config.php read-only file system constant. That will allow for file system changes by deploy only. The plugin editor, theme editor, and any other tool that allows direct codebase changes won't work when enabled.
- Restrict access to login and admin by IP address if it's a business accessing from a static IP (most mid-to-large businesses will be). This may not be a good option if people work from home, or need access to WP on mobile devices. Yes, IP addresses can be spoofed - but it's a significant jump up in protection regardless.
- Require approval for user creation
- Use a secure host specifically tuned for WordPress, they have all kinds of protection under the hood
Lot's more can be done as well, but these are good starting points. Personally i'm not a fan of WordFence for various reasons.
Should I not use a code formatter if the other dev on my team doesnt?
I'm working on a project where I've done everything mentioned here, and have burned a lot of time adjusting prettier and php-cs-fixer rules to get as close as possible to existing coding conventions. The problem is there are no conventions, so inevitably some re-formatting gets committed. I'm cautious to keep reformatting changes isolated to well labelled commits, but it's clearly a very large issue to the other dev on the project. I'm pretty sure a single large reformatting and adoption of code standards/formatting will ultimately solve this exact problem though.
They're vehemently against using it though, and they're over the top aggressive about absolutely any formatting change that get committed. When asked the strong response is that it will "wipe out years of commit history for the project". I don't follow that logic, if it's all done at once in a single commit you lose nothing? A few newlines and spaces between parenthesis isn't going to wipe out anything, and in the rare case where it's inconvenient for any review you can run a diff ignoring whitespace.
I'm beginning to wonder if it's actually anxiety about another developer changing something he's worked hard on for years, and being uncomfortable with metrics about lines written/changed (which was mentioned). I'm very sympathetic to the former, and don't worry about the ladder, but at the same time a lack of auto formatting for SCSS, JS and PHP feels like the stone ages and is very much a slower, inferior way to work. When I try to sell the benefits, which actually will help solve the very things he suggests are the problems I'm told to use their editor (Vim) because it auto formats (only using editorconfig) in place of my own (Sublime Text), or use interactive git adds to pick through every commit and remove the formatting differences. Both seem like large asks in my opinion.
The other counter argument is that "many developers have worked on the codebase over the years, and they all want to use their own formatting. Updating the codebase to support the preferences of one developer isn't something we should do."
Wouldn't using standardized code formatting be an ideal solution to this problem? I'm open to using whatever rules he prefers, entirely his call.
It's just such a strange and strong reaction to something so trivial. The trouble is I've just started working with this team in the last few months, and he's been there a while. Other team members are not programmers/developers, so I don't want to come off as an unreasonable new guy making unnecessary changes. But at the same time I don't want work productivity to fall behind on account of formatting differences, requested reverts/rollbacks and a general hyper focus on a lot of the code I commit.
Am I the unreasonable one here?
Simplest way to start a website and then ecommerce?
Editing tools on their site, it's a good one but not if you have 100 pages or more. It will definitely feel more restricted than WordPress.
Need Help Publishing a New Page on GitHub-hosted WordPress Portfolio Site
It just seems strange, static sites were created to avoid a CMS altogether. Doesn't mean you can't do it, if it works for you then kts a good option.
What's the difference between using a email plug in and an external email platform?
Sorry, I haven't seen those flags/reminders but I'll watch out in the future. These truly aren't to promote. that post just explains exactly what's discussed. Ni reason I can't just bring pieces here though.
How to improve performance.
I just looked at the live site and the performance is worse while scrolling. Enough that I can tell something is off.
I'd first look into a scenario like this:
https://stackoverflow.com/questions/53250714/web-website-is-laggy-when-scrolling-on-chrome
Something is doing an expensive task onScroll and it's slowing everything down.
Largest Contentful Paint
I couldn't find that homepage Image URL, but I pulled this from the live site:
https://illpumpyouup.com/wp-content/uploads/2020/05/man-squatting-with-pads.jpg - 6.14mb
Here's a quick and easy way to optimize it:
Just save that and you have a WebP that's 1920 pixels wide and 421kb. You can also do a lot more with that service, documentation is at wsrv.nl
Can you use Shopify on Wordpress sites?
Shopify and WordPress can be used together well, and Shopify is definitely easier to work with, this coming from a heavy WordPress user. Here's a real world example I built:
They sell a book through Shopify, and ghe site is WordPress. It's been stable for years.
Shopify is easier to understand, handles a lot more for you behind the scenes, and generally won't break on you. WooCommerce is great if you want a specific ship, Shopify if it's relatively standard.
All WordPress emailing system stopped working after I added google suit as email platform
It sounds like you may have configured your site to send with SMTP using an email setup through your web host.. When you switched the DNS this would stop working because the old email server isn't available anymore. You need to configure sending with SMTP through Google Apps Console. It can be done, I did it recently, but it's kind of a PITA.
How Would You: Form to create list, lock info behind paywall?
Agree with this,
Gravity Forms has a field type that will allow you to create a post from a form submission. I'd probably create a custom post type for your listing posts and use that.
https://www.gravityforms.com/add-ons/advanced-post-creation/
Building my first ecommerce website.. What are the do's and don'ts??
Not just the downtime, you'll spend a lot of your own time dealing with issues that would otherwise be non-existent. Using something like Kinsta has a higher price tag, but long term it's a savings.
What's the difference between using a email plug in and an external email platform?
Looks like you can use SMTP with Hostinger's email:
Host: smtp.hostinger.com Encryption: SSL Port number: 465 SMTP Username – the email address you will use to send emails from SMTP Password – it will be the password of your email address
https://support.hostinger.com/en/articles/4725594-how-to-set-up-the-easy-wp-smtp-plugin-on-wordpress
Implementing Seamless Login Redirection from WordPress to SaaS Application
I disagree,
They clearly say it's only about achieving the Asana style redirect experience. The 4 items listed are what they want to understand for that end result. Knowing that the redirect is the sole focus is key, my recommendation is definitely still the approach I'd go with.
How can I make my website go faster?
Can you share the URL?
To really improve you've got to understand the problems you have first before recommending any good solution or fix.
Recommending a bunch of general stuff before reviewing the problem doesn't make much sense to me.
Simple IP tracking by page?
UTM parameters are the standard way marketers track advertising like this. You add URL parameters onto the end of your resume links like this:
https://www.yourwebsite.com/?utm_source=resume&utm_campaign=linkedin
The IP address might work, but any Apple iOS devices won't be accurate because of ITP. With this you're looking at something that's more reliable. it doesn't have to be the UTM pattern either, you can really use whatever parameters you like.
Implementing Seamless Login Redirection from WordPress to SaaS Application
SAML, OAuth or any single sign on is only needed if you need both websites to support centralized access controls. Like if a customer needed a single login to get into WordPress AND the SaSS app.
It sounds like we just want a redirect for logged in people. If your SaSS users never log into WP, which sounds like the case, then SAML/OAuth are really the wrong solution. They work well for a corporation that wants control over access to the WP install, but this sounds different.
Implementing Seamless Login Redirection from WordPress to SaaS Application
This is a good one, my sweet spot that I've done a lot on professional sites.
The question is do you need a WordPress session tied to your SaSS app, or do you need the ability to work with your SaSS apps sessions on your WordPress domain. Based on the Asana example, I think the ladder most likely.
Usually the app and WP are using the same root domain with different subdomains. If that's the case then you could:
- Set an HTTP only cookie on the root domain, so that all subdomains can access it
- Create an API on your WP site that makes a POST request to your SaSS app to check for a valid app session. Your SaSS app team may need to add this for you, but chances are they already have something that will work by returning a 403 if they're not logged in.
- Visits to WP make AJAX requests to the SaSS session endpoint, if the session is valid they're redirected
The AJAX POST avoids the session check ever being cached, which you definitely don't ever want. But the rest of the site is cached and remains very fast.
The end result:
- I visit your marketing website
- AJAX API request is made to your SaSS app to check if I'm logged in
- If YES, I'm redirected with JS to the SaSS app
- If NO, I browse the site as a prospective customer
There are other approaches that can be used for advanced scenarios, like if you wanted "Hello, Kevin" in the upper right of the marketing website. Or to do this across domains with something like Auth0.
This is my sweet spot, I'm quite good at it. If you ever need any help from a consultant/contractor hit me up!
I hope this helps
Create WP user registration/login with 3rd party validation without password
They're a couple different ways you could do this, I'd probably use the built-in auth hook which allows you to replace the authentication method. You could set this to be your SSN approach for subscribers, the hook into the wp-login.php page to adjust the login form fields. \
// Define a custom authentication function
function custom_authenticate($user, $username, $password) {
// Perform your custom authentication logic here
// For example, check against an external service or custom database table
// If authentication is successful, return a WP_User object
// If authentication fails, return a WP_Error object
if (/* Your authentication condition */) {
// Authentication successful
return new WP_User(/* User ID */);
} else {
// Authentication failed
return new WP_Error('authentication_failed', __('Invalid username or password.'));
}
}
// Hook into the authenticate filter to use the custom authentication function
add_filter('authenticate', 'custom_authenticate', 10, 3); Two simple questions
- No programming skills are necessary.
- Of course.
What you really need is grit. It takes a long time for a Blog to build momentum and become successful these days.
Plugin that allows unregistered users to upload photos?
Gravity Forms will allow this and it works well, just be sure to restrict it to the file types you need only. Also good to limit the size of uploads too.
Why the hell forms fails ??
Forms don't fail, people fail.
URL problems
You need to set the Home page as your from page, then create a Blogs page and set that as the Blogs index.
I do this on just about every site I setup:
Create the pages for your front page and blog page. Go to Settings > Reading in your WordPress dashboard. Choose "A static page" under "Your homepage displays." Select your front page and blog page from the dropdown menus. Save your changes.
Updates Say They're Completed--but Still Appear?
Often times I've found its PHP OpCache and/or object caching.
WordPress Plugin Abuse
So you passionately agree, but you want to avoid my profile like the plague?
Any way to speed up it's "typing" responses?
Good points all around, makes sense
What's the difference between using a email plug in and an external email platform?
Third party transactional email providers basically give you a virtual email address that sends mail out from your domain. They provide the connection settings you would put into one of those SMTP plugins.
For the SMTP plugins, I very much think they're ridiculous. Here's why:
https://www.kevinleary.net/blog/wordpress-plugin-abuse/
"Should you really use a WordPress plugin for that? See how 11 lines of code can replace 87,907, and why that's a major advantage."
That code line mention... an SMTP plugin.
Performance issues
Find the source of the slow performance.
I'd always start there, then the path can lead many directions. And there's always a cause.
To do this Query Monitor is a good plugin that will show you a lot which can help. Also check your access logs for strange behavior to pages like wp-cron.php and xmlrpc
How to create a comment box
Should be built in and appear when you turn on discussions under settings. But usually only in Posts and not pages.
If you want a code explanation you dan use the WordPress comment template tag to display the comment section, just add this tag where you want the comments to appear.
The best tool for ecommerce
My professional recommendation, with much experience, would be:
- WooCommerce for eCommerce with Blocks for managing widgets/modules in a clean way
- Shopify, because it's better at eCommerce but it'll be very limited for customizations.
But it really depends on what the e-commerce use case is. Subscriptions/memberships to access content, I'd recommend building a simple Stripe plugin to handle it cleanly. For a store of digital or physical products, WooCommerce/Shopify is good.
Is it possible to completely edit a theme?
Not protected, quite the opposite. They're all open source licensed which means you can do just about whatever you want to your own site. But you need to know how to code.
If you want a no-code option then Blocks or Elementor are good options.
Need Help Publishing a New Page on GitHub-hosted WordPress Portfolio Site
WordPress and GitHub pages are two separate things. You don't use WordPress to build a static site, or shouldn't, so this doesn't really make sense to me.
I have two view columns?
If this is a WordPress.org site then those are custom. There's really no way to know what the numbers are without knowing more about your site.
CloudFlare is a very good option, though the analytics aren't that robust. Google Analytics is another, but a large percent of it is blocked by browser tracking protection these days so I don't consider the number to be accurate.
Custom CSS for a specific page
This is a great minimal option:
https://wordpress.org/plugins/simple-css/
It will add a metabox below the editor that you can use to add CSS to just that page.
Mystery Spam Text Added
This is correct, at some point the site was compromised.
Sucuri provides a good service to help clean it up:
A way to make ChatGPT less chatty when asking for code
tell it to "make all your answers shorter and more precise", that will change a user level setting for all of your settings
A way to make ChatGPT less chatty when asking for code
Good stuff, I've been telling it to "provide concise answers" which slims down the results. But for code this is good stuff, thanks!
Any way to speed up it's "typing" responses?
It's potentially doing something that could take hours or days in the time that typing happens. The idea that it's too slow is like being given a ride when you were walking 50 miles on foot, then complaining about the driver going to speed limit. Enjoy the ride, it's a lot better than the walking you were doing 3 years ago.
That said, I suspect that time will speed up as OpenAI adds new GPT versions. It may also slow down for some, it depends on how complex the work is. But it has to process, there's no way around it but that should really be fine.
One thing you can do is tell ChatGPT to "provide concise responses" which will avoid a lot of the descriptive fluff it generates. It won't necessarily respond faster though, but it makes working with the answers more productive.
WordPress Plugin Abuse
Should you really use a WordPress plugin for that? See how 11 lines of code can replace 87,907, and why that's a major advantage.
WordPress Plugin Abuse
Simplest way to start a website and then ecommerce?
Honest recommendation: Shopify or Squarespace. They'll be easier to work with.
Funny recommendation from a guy that's been developing primarily with WordPress for a long time, but I have built with these two enough times to know it's the best advice.
How should I move Wordpress between hostings?
The simplest explanation would be:
- Generate a ZIP of the entire /wp-content/ directory
- Export a copy of the database with WP CLI. If the URL is changing then the search-replace command with --export works well.
- Import both into the new host
- Test the new host using your local hosts file to verify it's been setup properly
- Update DNS records to point to the new host
WP Migrate DB Pro is a good professional option that may be worth exploring.
Can i add a file to the /public_html folder?
Totally fine to do it and it'll work for what you've described.
If you wanted to get fancy you could setup a rewrite rule that maps /pdf/* routes to PDF uploads in your media library. That would allow you to upload within WP instead of FTP every time.
New to WP and stressed out..
Heres the thing, and this is really common, it sounds like whatever theme you're using is the problem, not WordPress. 99% of the complaints or troubles I see with WordPress are actually specific to a theme or plugin that's completely separate. Hate the player, not the game.
That said, the frustration is legit, there are just so many different variabilities. For what you've described Id recommend checking out the Storefront starter theme for WooCommerce:
https://woocommerce.com/products/storefront/
Its built by the WooCommerce dev team, so it's less confusing and more stable to work with.
An alternative is the underscores theme, which is a starter for custom themes but not specifically WooCommerce.
Wait...did WordPress development get good while I was away?!
I've worked with Timber/Twig themes, it's a nice approach. Actually built out a few sites for the agency that built it (Upstatement).
I usually just install twig with composer and use a minimal setup. That's much simpler, and has a much smaller footprint. Upgrading timber can sometimes be a headache.
Wait...did WordPress development get good while I was away?!
I very much dislike that theme.
Wait...did WordPress development get good while I was away?!
If you build custom themes, it's honestly always been good, 2014 and today. If anything it was simpler and easier to work with in 2014.
The thing is, it's tremendously flexible so it can be absolutely stellar, but it can also be a steaming pile of crap. Work with a theme like Avada and you'll probably still hate it, but if you're developing with Laravel then start with the Roots Sage theme and you can work with blade and a loose MVC framework to build out a custom theme.
How can I restrict OneSignal notification sending to specific user roles in WordPress?
Good approach I'd use
Is migration from Wordpress possible
Also... I'm a sharp programmer 😄
Is migration from Wordpress possible
You'll need a sharp programmer to do it, but it's entirely possible. I'd recommend Laravel when the time comes. anytime someone reaches out to me about a site with membership or user profiles I always ask how many users they expect to have. If they say anything over a thousand I usually recommend Laravel, but it depends on the situation. WordPress doesn't handle a lot of users well in comparison.
Getting numerous suspicious POST requests from my own Server
admin-ajax.php is the Heartbeat API, which WP uses to extend user sessions while they're active.
wp-cron.php is the scheduled tasks system in WP.
Both can be disabled if you'd like. For WP cron you need to replace it with a server cron process. Highly recommended if you can do it, it makes the WP admin UI much faster.
Help! I am way out my depth
Copy the site to a staging server and deactivate plugins one by one to see which one is the source. Combining this with Query Monitor as others have mentioned is a good way I typically use a lot.
Is LinkedIn just a waste of time or am I doing something wrong?
The real advantage I've found is the friend of the friend factor. I've received good leads that turned into customers based on a person knowing someone that's worked with me in the past. Most recently, someone I built a website for 14 years ago reached out and we started a new relationship. These leads are also much easier to close because of the personal connection aspect. People feel a lot more comfortable if someone they know and respect knows and respects you.
As for cramming keywords into your job title and profile to find cold leads, that wont really work so well.
Now that we have Gutenberg, are you still using ACF?
Yup, and I use it to build Gutenberg blocks.
Beyond that ACF provides a means to truly separate content management from the way it looks or is presented. There are huge advantages to that pattern/approach.
What does everyone use to build Wordpress websites?
Same boat for me, the main advantage to building custom themes is precision, stability, and flexibility for advanced customization.
As an example, let's say a $100M+ organization has a web based onboarding flow that's critical for their business. Having that up and running 100% of the time is very important, and a custom theme or plugin is the best approach. They also probably have a strict branding guide, and a low tolerance for unexpected variability.
How to access GCS via SFTP?
39 pounds per month for a simple SFTP relay is ridiculously expensive in my opinion.
Suddenly having an information blog has become a crime on this platform
The reality is that asking a tool like ChatGPT for an answer to something is often faster, I find myself doing it for everyday things like questions from kids. If Google's goal is to provide answers to questions, it only makes sense no matter how inconvenient it is.
But those answers largely come from the websites publishing information, it needs that source, right? It'll be interesting to see if/when citations become required by larger players that own the source.
I do wonder what it'll do to our collective ability to critically think. I know my spelling and grammar has deteriorated since auto-correct became widespread. How GPTs will affect general thinking laziness is somewhat horrifying. Individual thought might become pretty sparse for a broad portion of the population in future generations, though you could argue it also has I guess.
Suddenly having an information blog has become a crime on this platform
Or have they...?
How to add shortcode to theme
If it were me I'd probably add a custom taxonomy called "Location" to blog posts, allowing you to group posts by their location. Then I'd set up the map on the homepage that links to a location term archive when a region is clicked. I can definitely code that, but I can't point you to a plugin that will allow you to do it without code. That's not to say one doesn't exist though.
What is the logic behind WP's media filename behavior?
I'm really just translating/documenting the WordPress core lines I linked to, but i can say that uploading a duplicate filename will append "-1", "-2", etc. onto the end.
WP accepts most common media file formats, but the vulnerability of a plugin that forces WP to accept additional file types would come from the file types it allows. If a plugin added support for webp images, that should be safe (I think - double check this), but one that enabled SVG graphics could be concerning, because SVGs caj have malicious code within them.
Another take on this that worked best for me with handling deep nested multidimensional associative and non-associative arrays:
/**
* Flatten a Multidimensional Array
*/
function array_multidimensional_flatten( $array, $position = [], $separator = '.' ) {
if ( !is_array( $array ) ) {
return false;
}
$result = [];
foreach ( $array as $key => $value ) {
if ( is_array( $value ) ) {
$position[] = $key;
$result = array_merge( $result, array_multidimensional_flatten( $value, $position ) );
} else {
if ( $position ) {
$key = implode( $separator, $position ) . "{$separator}{$key}";
}
$result = array_merge( $result, [$key => $value] );
}
}
return $result;
}
Using it with a large multidimensional array will output something like this:
[
'hero__overlay-opacity' => '100',
'hero__lead-in' => 'Underwritten by TruStage® Insurance',
'hero__optimize' => '1',
'hero__layout' => 'centered',
'flexible-content.0.acf_fc_layout' => 'title',
'flexible-content.0.acfe_flexible_toggle' => '',
'flexible-content.0.text' => 'Enabling Smart Financial Decisions',
'flexible-content.0.size.value' => 'lg',
'flexible-content.0.size.label' => 'L',
'flexible-content.0.size.alignment.value' => 'center',
'flexible-content.0.size.alignment.label' => 'Center',
'flexible-content.0.size.alignment.weight.value' => 'normal',
'flexible-content.0.size.alignment.weight.label' => 'Regular',
'flexible-content.0.1.acf_fc_layout' => 'grid-stats',
'flexible-content.0.1.acfe_flexible_toggle' => '',
'flexible-content.0.1.columns.0.statistic' => '85+',
'flexible-content.0.1.columns.0.description' => 'Years of Experience',
'flexible-content.0.1.columns.0.1.statistic' => 'A',
'flexible-content.0.1.columns.0.1.description' => 'Financial rating1',
'flexible-content.0.1.columns.0.1.2.statistic' => '4.75 / 5',
'flexible-content.0.1.columns.0.1.2.description' => 'Rating on TrustPilot',
'flexible-content.0.1.2.acf_fc_layout' => 'icon-columns',
'flexible-content.0.1.2.acfe_flexible_toggle' => '',
'flexible-content.0.1.2.title' => 'Insurance Products',
'flexible-content.0.1.2.background' => 'rgb(246,246,246)',
'flexible-content.0.1.2.alignment.value' => 'center',
'flexible-content.0.1.2.alignment.label' => 'Center',
'flexible-content.0.1.2.alignment.style.value' => 'default',
'flexible-content.0.1.2.alignment.style.label' => 'Bordered Circle',
'flexible-content.0.1.2.alignment.style.column.0.icon_type' => 'icon',
'flexible-content.0.1.2.alignment.style.column.0.icon' => 'insurance-add',
'flexible-content.0.1.2.alignment.style.column.0.image' => '',
'flexible-content.0.1.2.alignment.style.column.0.title' => 'AD&D Insurance',
'flexible-content.0.1.2.alignment.style.column.0.link' => '/insurance/accidental-death-dismemberment/',
]
Extracting excel files from the FTP to BigQuery using Cloud Functions
There's now a built-in SFTP connection that can be used for this:
https://cloud.google.com/integration-connectors/docs/connectors/sftp/configure
Need help. Every site change requires a cache purge.
I was actually suggesting you turn it off if it is on.
Trying to change search results title
Nope, its going to start with
Need to delete the gap within the template
Not sure what you have going on there, sorry. It looks like you're wrapped up in too many groups. Probably easiest to just recreate the page, it doesnt look like you have much in there.
Inexpensive Wordpress Web Hosting?
This isn't the same way you'd setup an AWS machine, it walks you through the process in a much easier way and does provide basic SFTP.
Custom pages per user
The author.php theme template allows you to do this.
Architecture Map
Can definitely be done with custom taxonomies and a post type. If you had more than 100,000 objects to list I'd say Laravel would be better for performance reasons.
Error establishing a database connection
Could be the MySQL user doesn't have the right permissions to access the database.
WP-CLI, what is it good for?
Cleanly deleting 10,000 posts at once
Running your own custom scripts with no time limit
Serialized find and replace
Anything in bulk, like creating 25 pages at once way faster than if you had to do it in the UI
Updating core, themes and plugins
I wrote my own invoicing software with WP, and I use custom commands to add line items to invoices, and send invoices via email as PDFs. It's much faster than a UI.
There are many things you can do on a command line or through a UI. Command line tasks have strong advantages often during development.
WP-CLI, what is it good for?
Cleanly deleting 10,000 posts at once
Running your own custom scripts with no time limit
Serialized find and replace
Anything in bulk, like creating 25 pages at once way faster than if you had to do it in the UI
Updating core, themes and plugins
There are many things you can do on a command line or through a UI. Command line tasks have strong advantages often during development.
Can i replace Broken images on bulk?
It's advanced, but I'd probably write a SQL script to remove the broken images,.
But you could give this a try too:
The "right way" to display ACF / custom post types?
The meat of what you're looking for is a class called WP_Query. You can also use "the loop" as others have mentioned and shown, but to specifically query and outlut a list of post type posts this class is a common go to.
Hi all!
You'll probably need a developer to solve it, but the error causing the issue should be in your web hosts "error logs". If you check there and it mentions a specific plugin you could try disabling it. But it's going to look pretty cryptic for you, it's definitely something technical that's meant for developers.
How to Adjust Line Spacing in 'Paragraph' Style
I think you can do this in Elementor's global typography settings, just set the Line-height option to be 1.0.
This outlines it well:
Are tags important?
The built-in tags have no SEO value, they're really meant to be a freeform alternative for organizing content when compared to categories.
Inexpensive Wordpress Web Hosting?
AWS Lightsail is $3.50 a month:
Best caching combination
If you're interested WPEngine uses Varnish for page caching, and Kinsta uses nginx static caching.
Also in a setup like this how you configure CloudFlare for caching is very important, I see a lot of sites serving up pages with DYNAMIC cache statuses. Tune for fully cached pages with their edge cache and the site will be extremely fast.
A lot of it comes down to the install itself too.
The absolute horror with wordpress
Anytime I hear rants about how WordPress sucks I think the complaints given are actually describing specific implementations of it.
It can be great, and it can be absolutely horrible. Its ultimately because of its massive variability and the broad ability to customize. I've seen some absolute disasters created by non-technical people slapping together plugins, thinking of the immediate need only. On the other hand I've seen it used by large businesses in ways that have been been amazingly stable. Its ultimately up to the person creating the site, there are thousand of ways to use it and that leads to thousand of problem giving people headaches unfortunately.
Is it possible to no-index blog posts/news articles before a certain date
Rankmath only adds a meta robots tag when something is set to noindex, otherwise it doesn't add one. You could just hook into the wp_head and add a noindex, nofollow meta robots tag when a posts publish date is greater than X days/months/years old
How to add shortcode to theme
Don't need to modify PHP code at all. Here's how you can easily do it:
- Create a new page called Home and another called Blog or Posts
- Go to Settings > Reading and adjust the options there to set Home to the frontpage/home screen and the Blog/Post page to be used for the listing page
- Add the shortcode with a "Shortcode" gutenberg block, or into an older editor like this [shortcode-name-here]
Best practices for pulling site offline for editing and restoring to live site.
WP Migrate DB Pro is the best way I know of, but it's expensive. WP Sync is similar and worth looking at.
Client can't get into her wp account, recovery options aren't working
Looks like WordPress.org, not WordPress.com, so no support is expected.
You'll need to get access to the webhost where she hosts the site. From there if you get SFTP you can create a user programmatically:
https://www.kevinleary.net/blog/wordpress-create-admin-user-php/
Fast, Cloudflare-Hosted Static WordPress Sites - Your Thoughts?
It's a common pattern used with a headless CMS approach, not necessarily with Cloudflare static sites. Usually for advanced control of security protocols though.
What are the best practices for offline backup of the WP-based website's content?
I think you mean "offsite" not "offline"
Need help. Every site change requires a cache purge.
Never used NitroPack, but it sounds like their Cache Warmup feature may be worth tuning. From what I see in their docs one of two things will happen when you save changes to content:
- If you’ve turned Cache Warmup off, NitroPack will optimize the content when someone makes an organic visit to the invalidated or purged page.
- If you have the feature on, the moment you change the content (invalidate or purge the URL), NitroPack will optimize the URL without anybody visiting it. In a way, the “Cache Warmup” feature acts like a human and visits the URL automatically instead of you or someone else visiting the URL.
It could be that #2 is on a CRON that's failing on your server, in which case it might work if you switch to option #1. If #1 is already selected you may as well try switching and see if that works.
Sometimes it's a matter of a plugin like this only purging the cache for that page, but not other pages that list it.
Converting hashtags in posts to Wordpress Tags. This code works only for web WP Admin posts; can it be modified to work for Jetpack official mobile app posts?
You'll want to have that same action fire when a post is created through the REST API, that's what the apps use.
Add this below the existing action, it should work for what you want:
add_action( 'rest_after_insert_post', 'post_published_notification', 10, 2 );
Need to delete the gap within the template
If that's actually adding space to the saved frontend view, and you think there's a rogue block in there that needs to be removed, try this:
- In the top right hand corner of the Gutenberg editor click the three dots to open the settings menu
- Select "Code editor"
- You should see the pesky widget in there with something like this before and after it:
- Delete/remove it, with the HTML comments before and after it.
What is the logic behind WP's media filename behavior?
Specific logic is in the sanitize_file_name() function:
I may be missing a few things, but this is close to all of it described:
- Removes special characters: ? [ ] / \ = < > : ; , "" " & $ # * ( ) | \~ ` ! { } % + ’ « » ” “
- Strips out UT8 PCRE characters
- Verifies it's an allowed extension:
- Removes any newline/return characters
- Replaces "%20" and "+" with dashes
- Replace more than one dot in a row with a single one
- Checks for multiple extensions, and if they exist postfix them with a trailing underscore if they are a 2-5 character long alpha string not in the allowed extension list
- If a file doesn't have an extension it checks the mime type and automatically adds one
- If the name of the file was the extension only without any dots it'll set the name to unnamed-file.{ext}
WPforms alternatives?
If you're comfortable with basic coding and CSS you could do it for free with Google Forms using a creative approach:
https://stackoverflow.com/questions/40560853/how-to-use-google-forms-without-iframe
That method has been working since 2016, so it's reliable.
How to centrally manage multiple landing pages?
Here are two good ways I'd consider doing it:
Custom Post Type w/Page Level Settings & Global Options
Create a custom post type called "Landing", and a single template for it. Use ACF to add page level configuration options you need, and an ACF options page to manage global fields shared by all pages. Editing in one place isn't really an option with this approach. There are ways to configure ACF fields to have bulk quick edit functionality, but it's really best for simple text fields.
Rewrite Rules, Single Template & Google Sheets
Create custom rewrite rules to handle the pattern you'll use for landing pages, maybe /landing/{slug}/, that loads a single PHP template in a plugin. Within that plugin, pull in data on-demand from a Google Sheets spreadsheet, where each row is a unique landing page and the columns define the variable aspects that change.
This would cover everything you need with a minimal system that's very scalable. It could handle a thousand landing page really well if you wanted. But the implementation is slightly more technical, not really though if you know how to do it.
Trying to change search results title
In your theme's header.php file, or wherever the
is, make sure your title tag looks like this:WP Updates - Oh no!
Kevinleary.net runs on a custom theme I built in 2009, 15 years running. It's been improved over the years, but never replaced.
Thanks for all your contributions btw
Wordpress speed issues
$20 mo / $240 yr for a regular shared plan, and you can addon storage only for a fee if needed.
Hardware to hardware, the VPS may be more powerful but in practice a truly WP optimized server will be much faster and involve far less work to maintain.
To replicate what WPE or Kinsta has on a VPS you need to install and configure a lot, and even then it's not going to run as smoothly. What you save on monthly price will definitely be made up for in terms of setting up and maintaining a VPS. Varnish, memcached, cloudflare, wpscan runs, git deployment pipeline, snapshot backups daily with a simple rollback, the ability to quickly spin up a staging or dev server, permissions management for files and folders. And theres more beyond this.
If a budget is very tight I usually recommend Amazon Lightsail over an inexpensive VPS:
https://aws.amazon.com/lightsail/projects/wordpress/
That's $3.50 a month and it is tuned specifically for WP.
Wordpress speed issues
I've worked with it, and you will see an improvement for sure. WPEngine is $20/mo, which is probably what you pay at SiteGround? Kinsta is a little better in my opinion, but slightly more money. Both are very comparable though and they truly do a lot that SiteGround doesn't do.
How to insert Google Analytics and Tag Manager in Twenty Twenty Four WordPress Theme?
With code it's about 15-20 lines of copy/pasted code that you add to the wp_head hook. No plugin will beat that overhead.
Wordpress speed issues
Have you ever used one of those "exorbitantly priced" hosts?
I've worked with and seen the VPS route, it's never once been advantageous and cost saving. I'm talking about long term true costs.
WordPress & MySQL Tuning: Start with monitoring before you touching configs
Good advice, I've solved major problems with single adjustment to the my.cnf file. Although some direction from MySQL tuner is sometimes useful.
Sometimes the issue isn't MySQL all, and you may burn up time thinking it is if you don't have monitoring like this. Always good to look at system logs too.
Old school php page templates or block templates in UI?
Honestly, building CMS tools to control the content, not the design, tends to be the easiest for clients. Forms with ACF inputs can go a long way, and if you do it right you don't need to train people at all.it should be intuitive enough to figure out after logging in.
If you have a client that is creating rich interactive long form articles then the Gutenberg editor works pretty well, but otherwise I've found that clients generally don't like it and find it cumbersome and confusing.
Thousand separator for numbers
Wordpress speed issues
Where are you hosting the site?
The initial page requests seem high, and your images don't seem to be optimized on a CDN. Honestly, switching to Kinsta or WPEngine may do the trick but I can't say for sure without digging deeper.
WordPress Plugin
It'll depend on the scheduling tools they use internally. You want those to sync up so that rescheduling and calls on the phone are immediately reflected in the appointment tool. Usually offices have their own existing software or system for this, and they may want to integrate with it.
Gallery options
WordPress has a built-in gallery function, and if you use the Gutenberg editor I'd suggest this for a minimal approach that does exactly what you want
https://wordpress.org/plugins/modal-block/
Coming from Squarespace to WordPress can be overwhelming. You'll find that there are literally hundreds of ways to do something, and everyone has an opinion on whats best. I recommend you go with whatever is simplest, has the least overhead, and does only what you want. Avoid installing a whole theme or plugin suite that does hundreds of things just for a gallery modal.
Contact form 7 and Hubspot
- Embedded Hubspot forms directly with JavaScript
- Gravity Forms with Hubspot addon
- API for advanced scenarios
Is there a specific order to update plugins, theme and WordPress core?
Short answer is no. But sometimes issues can happen with plugins that have a pro version installed. Like Elementor, if you have Elementor and Elementor Pro then make sure you always update both at the same time to avoid issues. The same goes for any other pro/non-pro combos.
A issue whit the posts. Siteground wordpress (login or ?)
Are you talking about the takeover feature, where only one person can edit a post at a given time?
If you are then there's no way around that one, WP will need to handle realtime editing like Google Docs first which is pretty complex.
Wordpress Plugin Question
Maybe this:
https://wordpress.org/plugins/bookly-responsive-appointment-booking-tool/
But I don't follow you with how the addresses need to be handled.
Script to load hundreds of pictures ?
Where are you loading them one by one?
If you can adjust the code to work with a gallery structure in your theme then you can do all 50 at once, then connect 50 to a given page/field. It can be parsed as a clean structure well.
Am I stepping on the previous developers toes?
For this case, nope. Because Elementor 2 years out of date is a pretty big security issue, there are numerous exposures reported for it. My opinion would be to clone the site to a staging environment, run the upgrade to see if anything breaks, and if it doesn't then go for it on the live site.
Generally speaking though, I'm of the opinion that you should be able to upgrade ANY plugin without issues if the site was well built. Elementor is kind of a different beast in that regard, so testing it out on staging first is best.
Need help adding ‘subscribe’ feature on Wordpress blog with Elementor editor (free version)
I built a custom setup that does this, feeding signups into a Hubspot list. When a new blog post is published it triggers a bulk send to that list using a custom transactional template. The same thing is used for product updates in a custom post type too. It's all lean custom code though, and the only part that would be relevant for Elementor would be the actual signups UI.
It could be done entirely in WordPress in a clean way with a custom database table for storing signups in place of Hubspot.
Living example exists at:
Form is in the sidebar on RH side of post content.
WordPress version 6.5 ships tomorrow - see some first preview images ...
JavaScript modules.
How to hire a Wordpress developer
I just read your post about WordPress "developers" and plugin overuse. I do EXACTLY what you described as working well, if you're interested my woro is @ kevinleary. net.
How to hire a Wordpress developer
It's far more common to see plugin soup unfortunately. I'm of the build your own mindset, for specific business needs. When you code for exactly what you need you end up with a much more efficient and stable WordPress site in the future. Its difficult to explain this fully without an example though.
I built TripAdvisor's official blog this way in 2014, and that custom theme was online and running smoothly until this year (IT decision to bring content over to core tripadvisor.com site). It handled 3 rebrands and served localized content to 14 different international TLDs. There wasn't a single occurrence of a plugin conflict or error. It just worked.
What do professional Wordpress developers use to create sites?
My opinions from working with WordPress professionally for 17 years.
When I build a custom theme, I start from scratch, and follow the basic principles that have existed in theme development for years. A custom theme built this way is very easy to understand, maintain, and scale up as needed because it doesn't follow any patterns sitting on top of WordPress. It's the equivalent of straight-up WordPress. When I build something more complex that requires advanced structure, I typically pull in Twig for templating, which is a common PHP standard. I used to do this with Upstatement's Timber framework, but now I typically do it in a minimal way within the theme instead. It's easier to work with, more stable, and doesn't break.
Over the years, I've inherited projects built by all kinds of agencies. Some have no business "developing" a website, while others do highly professional work on websites for big brands. Here are some of the patterns and takeaways I've learned:
-
Gutenberg isn't really so great, clients typically have trouble with it, and it's not all that intuitive enough for people to pick up easily
-
Elementor is very common, and it can be good, but there are certain scenarios where you shouldn't use it: any site with more than 100 pages, for an organization with strict corporate branding guidelines, or for sites where modularity and universal layouts are important for you to manage. Controlling things universally like spacing, typography, colors and more can be done using their framework, but it's a hell of a lot more difficult than it would be with simple SCSS patterns.
-
Advanced Custom Fields Pro is used by many mid-to-high level agencies building custom sites for clients
Based on what you're after, I'd explore option #3, which is also an approach I've both taken and seen taken numerous times. It's an old, time tested pattern that has some strong principles behind it.
As a final thought, in the right hands WordPress can be used to power cutting edge, modern websites with smart CMS tools. On the flip side, it can be a steaming pile of overweight plugins that make for a tremendously difficult situation to both work with and maintain. Unfortunately, the ladder is more common.
Creating your own framework in WordPress is a great idea, my advice would be to start from scratch and reference the theme template hierarchy documentation at https://developer.wordpress.org/themes/basics/template-hierarchy/. This will give you a solid understanding of how simple a theme can actually be, which is much better than diving head first into the tom foolery that exists in frameworks like Sage.
I've added a very basic demo to GitHub that may help you get started:
https://github.com/Kevinlearynet/basic-wp
Hope this helps!
Deleting 49k posts in bulk
Most efficient way I'd do it:
wp post delete --force --defer-term-counting $(wp post list --tag_id=721998 --format=ids);
This will handle it all in one line, just replace the tag ID with the one you want to remove. The wp post list command works with any of the non-complex arguments for WP_Query, so this can work for a lot of scenarios.
How much should I expect to pay to hire a WordPress developer?
I've been developing custom stuff for businesses using WordPress since 2008. Currently I bill $125/hr, and I do work on some reputable sites for well known brands. Here's my general advice for anyone in this situation.
To make sure you choose someone who knows what they're doing:
Have them show you real world examples to backup any work/experience they mention. I always end up doing this on initial calls myself, it's a great way to show some proof of what I claim I've done. It's usually on pretty reputable websites at recognizable brands, and that's tough to fake. This doesn't mean that there aren't very talented people out there that are still building experience, because there definitely are, but the reality is that it's a reasonably good way to evaluate someones level of understanding.
As a developer on the other end of this, here's what I'm looking at to determine that time/cost estimate:
- What theme does this site have? Is it good, or is it a one-size-fits-all nightmare purchased from ThemeForest.
- How many plugins have you relied on to get what you have today?
- Is WP and all plugins/themes up to date?
- Where you're hosting the website
- How organized were you when you reached out: did you send specific, well documented details about what you need with links to the pages, or was it a vague request without any details
- What's the topic of the site: if you're a business, then you'll probably want someone to help long-term and that's more appealing. If you're an individual or someone that needs one specific thing fixed and that's it then you're honestly less appealing. For the record, in no way do I ever try to hook people into depending on me.
That should maybe help you or anyone else looking to hire a WordPress developer to work on your site. The price does depend a lot on you and how you approach it.
Keep in mind too that everyone in this position generally wants three things:
- Done fast
- High quality
- Low cost
Pick any two, that's all you'll get.
Plaid PHP SDK
@seaphpdev has a good description. Think of it as an API that makes it possible to programmatically work with banking data in a secure way. You can use it to do things in an app like export transactions from a credit card account, or export transaction data from banks without an API like Bank of America.
15 Years of Wordpress - some advice from an old 40-something.
I've been building for WP sites for businesses in Boston, and all over really, for the last 14 years. I have an approach for this that works pretty well:
I recommend that clients start without CMS controls in many places, and then add them in after they make 2-3 changes in a small time frame to something. This keeps the theme minimal and fast, and surprisingly light and easy to maintain.
Most of the people I work with do update the CMS on their own entirely and frequently. Content marketing is probably the why, but the hybrid approach o take is to host on a WordPress specific host, removing the tech stack headaches. Use CloudFlare for most security concerns, also minimal overhead.
As of November 2022 there's a nice, clean way to do this using the CSS clip-path property.
div {
box-shadow: 0 0 10px black;
clip-path: inset(0px -10px -10px -10px);
}
Inset will clip away the element from the top, right, bottom, and left edges. For a this shadow in the example we're clipping anything beyond the top bounds, hiding the shadow on the top, and allowing 10px of space for the shadow on all other sides.
It's the clean, ideal solution to the problem in my opinion. Browser support is good, but if you want support in IE11 still you'll want to explore the polygon option instead of inset.
Wordpress function cache_users not found after update to 6.1
It can be patched from a must-use plugin. Add a new file at /wp-content/mu-plugins/cache-users.php and add this to it:
<?php
/**
* cache_users() Polyfill
*
* Patch for issues with WP_User_Query in WP 6.1
*/
if ( ! function_exists( 'cache_users' ) ) {
function cache_users( $results ) {
return $results;
}
}
That will safely patch the issue without modifying the WordPress core files until it's resolved in a follow-up release. It's bypassing the cache which isn't ideal, but it resolves any fatal errors reliably.
On a Mac with Homebrew it's simpler than the other mentioned approaches.
.woff2 to .ttf
brew install woff2
woff2_decompress somefont.woff2
This will leave you with somefont.ttf in the same directory.
.woff to .ttf
Converting WOFF (not woff2) is a little trickier, woff2_decompress probably won't handle it. You would first want to convert the .woff file to .woff2, then use the woff2_decompress command to turn that into .ttf file.
There's a brew tap that can be used to install sfnt2woff, which can be used to convert your .woff to .woff2.
brew tap bramstein/webfonttools;
brew install sfnt2woff;
sfnt2woff somefont.woff;
woff2_decompress somefont.woff2
Twig + wordpress - how to get filemtime for style.css
I prefer this approach for flexibility.
functions.php
/**
* versioned_theme_uri() Twig Function
*
* Create an auto-versioned URI for a relative theme file.
*
* @param \Twig\Environment $twig The Twig environment.
* @return \Twig\Environment
*/
function kevinlearynet_extend_timber_twig($twig) {
$twig_function = new Timber\Twig_Function( 'theme_uri_versioned', function ($theme_file) {
$uri = get_theme_file_uri( $theme_file );
$filepath = get_theme_file_path( $theme_file );
$version = file_exists( $filepath ) ? filemtime( $filepath ) : 'FILE_NOT_FOUND';
return "$uri?v=$version";
} );
$twig->addFunction( $twig_function );
return $twig;
}
add_filter( 'timber/twig', 'kevinlearynet_extend_timber_twig' );
Theme .twig template
<link rel="stylesheet" href="{{ theme_uri_versioned('dist/app.min.js') }}" type="text/css" media="all" />
Require module without webpack etc
That package includes a fallback global, so you can do this:
import './scrollMonitor';
This makes scrollMonitor available on the window object for you work with.
error TS2554: Expected 1 arguments, but got 0. Angular6
It's a valid error, and isn't caused by the fullTemplateTypeCheck compile option per say. It happens when you create an instance of an object who's class makes use of Angular injectable's. If you switch to using the class as an injectable, it's solved.
Here's a working example. Let's say that we have a service class that looks like this:
Service Class
/**
* First Service
*/
import { Injectable } from '@angular/core';
import { SecondService } from './second-service';
@Injectable({
providedIn: 'root',
})
export class FirstService {
constructor(public secondService: SecondService) {
...
}
}
If you try to use this in another service or component with new FirstService(), you'll see the error.
Broken
/**
* Third Service
*/
import { Injectable } from '@angular/core';
import { FirstService } from './first-service';
@Injectable({
providedIn: 'root',
})
export class ThirdService {
firstService: any;
constructor() {
this.firstService = new FirstService();
}
}
The error error TS2554: Expected X arguments, but got 0. happens because the injectable class does have parameters if you attempt to instantiate it directly like this. If you use it as an Angular injectable, it's no longer an issue.
Fixed
/**
* Third Service
*/
import { Injectable } from '@angular/core';
import { FirstService } from './first-service';
@Injectable({
providedIn: 'root',
})
export class ThirdService {
constructor(public firstService: FirstService) {
...
}
}
Using the FirstService as an Angular @Injectable solves the problem.
@intotecho's answer was very helpful in determining this.
Double defined constants
To fix the specific error here you can check if a constant is already defined before defining it:
if ( ! defined( 'DIR_FS_CATALOG' ) )
define( 'DIR_FS_CATALOG', 'something...' );
I'd personally start with a search in the codebase for the constant DIR_FS_CATALOG, then replace the double definition with this.
Hiding PHP notices inline, case-by-case
PHP provides the @ error control operator, which you can use to ignore specific functions that cause notices or warnings.
Using this you can ignore/disable notices and warnings on a case-by-case basis in your code, which can be useful for situations where an error or notice is intentional, planned, or just downright annoying and not possible to solve at the source. Place an @ before the function or var that's causing a notice and it will be ignored.
Here's an example:
// Intentional file error
$missing_file = @file( 'non_existent_file' );
More on this can be found in PHP's Error Control Operators docs.
Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in
I wouldn't recommend disabling the wp_ob_end_flush_all() function entirely, and I definitely wouldn't turn off zlib.output_compression in your php.ini file. Here's a better approach that replaces the source code causing the issue, and preserves the underlying functionality:
/**
* Proper ob_end_flush() for all levels
*
* This replaces the WordPress `wp_ob_end_flush_all()` function
* with a replacement that doesn't cause PHP notices.
*/
remove_action( 'shutdown', 'wp_ob_end_flush_all', 1 );
add_action( 'shutdown', function() {
while ( @ob_end_flush() );
} );
More details on the cause, and why this is probably the best approach can be found here: Quick Fix for WordPress ob_end_flush() Error
How to use ionicon in Angular component?
The following command will allow you to use the ion-* classes and the <ion-icon name="..."></ion-icons> web component that's available with Ionicons 4.x:
ng add @ionic/angular
This is a built-in Angular schematic that installs the Ionic library and it's components, which includes icons. Once this complete you can use Ionicons in your project like this:
<ion-icon name="logo-facebook"></ion-icon>
The name property corresponds to the value provided in the Web Component Code provided for a specific icon at ionicons.com.
Can i use a Subject to make a custom async validator?
Absolutely, just return the subject with asObservable():
forbiddenEmail(control: FormControl): Observable<any> {
const subject = new Subject();
setTimeout(() => {
if (control.value === '[email protected]') {
subject.next({ emailIsForbidden: true });
} else {
subject.next(null);
}
}, 2000);
return subject.asObservable();
}
How to clear the FormArray values in angular reactive form?
The best way to do this as of Angular 8+ is with the clear() method provided with FormArray:
// Reset all tags (Angular 8+)
resetTags() {
const nodTags = this.profileForm.get('nod_tags') as FormArray;
if ( nodTags.length > 0 )
nodTags.clear();
}
If you're using Angular 7 or below, then Mizanur's version will work. Here's a modified version of the resetTags() method that uses it:
// Reset all tags (Angular 7 and below)
resetTags() {
const nodTags = this.profileForm.get('nod_tags') as FormArray;
while ( nodTags.length > 0 ) {
nodTags.removeAt(0);
}
How to export swagger.json (or yaml)
The JSON may also be inlined in the document, specifically for Swagger version 2.0. If you haven't found anything after walking through @Helen's answer give this a try:
- View Page Source
- Search for
"swagger"or"spec"
If you see a <script type="application/json"> tag with something similar to the following in it, this is effectively your swagger.json content. Copy everything inside of the <script> tags and save into a file named swagger.json and you should be good to go.
<script id="swagger-data" type="application/json">
{"spec":{"definitions":{},"info":{},"paths":{},"schemes":[],"swagger":"2.0"}}
</script>
How to fix JQMIGRATE: Fixing 'ready' event
Replace this:
$( document ).on( 'ready', function() {
// Stuff here
} );
With this:
$( function() {
// Stuff here
} );
Or for a more modern version:
$( () => {
// Stuff here
} );
You can definitely do this with vanilla JS like stecb has shown, but I think each is the best answer to the core question concerning how to do it with lodash.
_.each( myObject.options, ( val, key ) => {
console.log( key, val );
} );
Like JohnnyHK mentioned, there is also the has method which would be helpful for the use case, but from what is originally stated set may be more useful. Let's say you wanted to add something to this object dynamically as you've mentioned:
let dynamicKey = 'someCrazyProperty';
let dynamicValue = 'someCrazyValue';
_.set( myObject.options, dynamicKey, dynamicValue );
That's how I'd do it, based on the original description.
How to "connect" a git repository without cloning it first?
Instead of:
git clone {remote-url} .
Directory Without Git Repo
If you don't already have a repo in the directory you're working in then this approach will work:
git init
git remote add origin {remote-url}
Directory With Existing Git Repo
If you do already have a repo in the directory you're working in:
git remote update origin {remote-url}
Now you have a repository that has been cloned, but is connected to your remote origin.
Angular 2 form validation, hasError is not a function
This is similar to another answer I've provided here: Form Builder with hasError() for validation throws an error of ERROR TypeError: Cannot read property 'hasError' of undefined.
The gist is that TypeScript getter's can be used to solve this in a clean way.
In your component class:
get departmentLocation() {
return this.myForm.get( 'departmentLocation' );
}
In your component template:
<input type="text" formControlName="departmentLocation">
<p class="ui error message" *ngIf="departmentLocation.hasError('required')">Department location is required</p>
Also important to note that using ngModel with Reactive Forms in Angular 6+ is depracated, so it's been removed from the examples above.
Angular 4 - Http to HttpClient - property 'someproperty' does not exist on type Object
Using bracket notation instead of dot notation to reference sidebar['content'] instead of sidebar.content will solve the issue.
The Type-checking the response section of the Angular docs on HttpClient mention's this, although it's not all that clear:
The subscribe callback above requires bracket notation to extract the data values. You can't write
data.heroesUrlbecause TypeScript correctly complains that the data object from the service does not have a heroesUrl property.
Form Builder with hasError() for validation throws an error of ERROR TypeError: Cannot read property 'hasError' of undefined
If you're working with reactive forms you should probably use TypeScript getter's to solve this, it's a lot cleaner:
In a reactive form, you can always access any form control through the get method on its parent group, but sometimes it's useful to define getters as shorthands for the template.
A getter will allow you to access a form field directly, avoiding the redundant use of myForm.controls['fieldNameGoesHere']. with ngIf in the examples above.
As an example, For company_address2 add the following after your ngOnInit() method:
get company_address2() { return this.myForm.get( 'company_address2' ); }
This will give your component HTML direct access to the company_address2 , give this a try instead:
<textarea class="form-control" placeholder="Address" rows="2" [readonly]="disabled" id="companyaddress2"
formControlName="company_address2">
</textarea>
<span class="help-block form-error text-danger small"
*ngIf="company_address2.hasError('required')">
Company Address 2 is Required.
</span>
You'll have the define each getter method individually though, TypeScript doesn't allow variables to be provided to getter's so you'll end up having one get method for each control in your form.
More info can be found in the Angular docs under Form Validation: Built-in Validators.
How to Disable the WordPress Gutenberg Editor
Mysql - How to compare two Json objects?
You can do this using JSON_CONTAINS:
SELECT COUNT(criteria)
FROM my_alerts
WHERE JSON_CONTAINS(criteria,'{"industries": ["1"], "locations": ["1", "2"]}')
This perform a comparison that ignores the order of the values, which is critical because MySQL will re-order JSON properties for efficiency on INSERT.
Great List of Big Brands Using WordPress
Then I guess any site you build won't be included
Great List of Big Brands Using WordPress
I agree with you, but I think it's on us as the developer to make the choice between WordPress and another option. It's a CMS, not an application framework. I typically choose between WordPress or Laravel at the start of a project based on what's involved. None of the sites in this list are applications, nor would I expect them to be really.
Great List of Big Brands Using WordPress
It can do incredible things when you understand it well. Here's an example I built myself:
- https://www.tripadvisor.com/blog/
- https://www.tripadvisor.co.uk/blog/
- https://www.tripadvisor.com.au/blog/
- https://www.tripadvisor.de/blog/
- https://www.tripadvisor.es/blog/
- https://www.tripadvisor.it/blog/
- https://www.tripadvisor.fr/blog/
All of these domains are powered by an API that serves localized content in 7 different languages, all from a single installation of WordPress (no multisite).
WordPress definitely is bloated on the database/query side of things, but with the right nginx caching policy and object cache enabled in PHP 7+ it can be very efficient. These sites collectively serve over 2M uniques monthly from a $500/mo stack. With the right setup, end users to a site should never make a single call to a database for a GET.
Great List of Big Brands Using WordPress
It's actually checking for /wp-content/, which would catch any plugins, uploads or theme references.
Great List of Big Brands Using WordPress
Actually, one of the reasons I did it is because the Showcase is pretty lacking. I don't see any of these referenced in the business tag there: https://wordpress.org/showcase/tag/business/. There may be a couple, but definitely not a lot of them.
Great List of Big Brands Using WordPress
They're currently ordered by #, with the lowest at the top. It's just that not all of the Fortune 1000 are using WordPress, so the numbers jump around as you move down the list.
Great List of Big Brands Using WordPress
I think this is an unfortunate result of the famous "5 minute install", combined with the free nature of plugins. Plugins make it "easy" to customize and bolt-on added functionality, but it's generally plugins that are the cause of "nightmare" WordPress sites. It's really important to vet plugins thoroughly before using them on a business site, and also to think of the future maintenance ramifications. Also, plugin developers aren't paid to maintain them, and they generally lose steam after a few years as a result.
Great List of Big Brands Using WordPress
It is, I basically wrote a bot that browses a list of websites for companies in the Fortune 1000 and checks for the existing of "/wp-content/themes/". In the example you mention it does match this, but I agree it looks like an ASP site referencing WordPress theme content in some way. For the future I'll adjust the script to look for a count of 5 or more instances/matches, which would solve this issue.
Thanks for pointing it out
Great List of Big Brands Using WordPress
If I could do that, it'd be a problem :) My guess is that the good ones probably use a combination of:
- Custom post types combined with custom taxonomies
- Custom templates configured with ACF fields, probably using ACF Pro
- Custom plugins for advanced functionality like third-party integrations and what not
Great List of Big Brands Using WordPress
yeah some do, I contemplated taking them out of the list but end up keeping them because they are legitimate Fortune 1000 companies using WordPress. I may remove them in the future though, they are a bit of an eye sore
About a modern WordPress development and deployment workflow, and modern technologies
What's your typical WordPress development and deployment workflow?
I use Git for every project, and I always deploy to a staging and production hosts with Git, never FTP. Most of the clients I work with are on WPEngine or Pantheon, so this comes standard. I also use a branching strategy that's similar to the GitHub workflow to safely isolate live "hotfix" changes from ongoing/incomplete project work.
Should I look into Sage 9, and learn the "complete package" using Bedrock, and Trellis for deployment?
I think you should look at Underscores and ditch Roots: https://underscores.me/. This provides much more of a clean slate to start with, and you can build up your own patterns and processes. Roots is too opinionated and overly complex (in my opinion), I value minimal systems and code.
Checkout the Timber plugin as well, which allows you to build themes using Twig syntax instead of PHP.
Or should I learn about Docker instead of Trellis?
Trellis and Docker are different things in many ways, I don't really have an answer for this as I don't work with either of them. I will say that it's dangerous to chase trends, and always better to learn the underlying technological benefits of one approach over another.
I use a local install of nginx and PHP 7.2 on my Macbook Pro. Using this instead of WAMP is more advanced and complex, but it allows me to mirror WPEngine's hosting environment accurately and also allows me to right bash scripts to automate my workflow. For example:
When I sign a deal with a new client I run a "setup-new-client CLIENT" command, where CLIENT is the name of the client which will:
- Create a MySQL database: "wp_CLIENT"
- Create a new folder in my ~/Sites/ directory
- Generate a self-signed certificate for localhost URL: CLIENT.test
- Download and install WordPress using the WP-CLI
- Install a setup of common plugins: Advanced Custom Fields Pro, Yoast SEO, WP Migrate DB Pro
- Run a few configuration settings for the site (permalinks, site name, etc)
- Create a .gitignore file from a template
- Create a private git repository on GitHub using their CLI, and set it as the projects origin
- Deploy to GitHub
Among other things, but you get the idea. If you move beyond WAMP/MAMP you can configure your own server that is optimized for your workflow.
Should I learn React to be able to take full advantage of Gutenberg?
I would say yes, but learn React to learn React. Don't do it just for Gutenberg, it's a great way to right stable JS code into a custom theme. I personally use Vue.js, but if you understand the underlying concepts it's relatively straight forward to switch between Angular/React/Vue (syntax headaches aside).
Is there any other cutting edge tool / technology which you recommend learning?
- WP-CLI has helped me automate a lot of the redundant things I do for clients
- Learn to use Git deployment instead of SFTP, I use a branch based strategy for all of the clients I work with which tend to be mid-to-large sized businesses. This workflow allows me to work on extending areas of a site, while also deploying live "hotfix" branches into product without breaking anything.
- Learn about ES6 and Node.js, I think both have a strong position in the future of web development
What is a good learning path for this? Any suggested resource? (books, websites, courses - even paid ones).
This is a great list that's always changing: miziomon/awesome-wordpress
Great List of Big Brands Using WordPress
Test a Website for ADA Compliance & WCAG Accessibility
I'm late to the party here, but working with dompdf in 2018 still seems to experience this issue when loading Google Fonts with CSS. The specific error I see is:
"Uncaught Error: Class 'FontLib\Font' not found"
With version 0.8.2 (July 2018) I solved by loading the php-font-lib library before loading dompdf using the following:
// Load DOMPDF library
require_once( 'composer/phenx/php-font-lib/src/FontLib/Autoloader.php' );
require_once( 'composer/dompdf/dompdf/src/Autoloader.php' );
Dompdf\Autoloader::register();
You'll need to make sure your composer path is correct here, I've removed a variable from the require_once() calls.
Home Brew PHP 7.2.5 Install with cURL
I've applied the patch supplied by dossy and it works!
Below are the specific steps to take to solve the issue. More details on what this fixes can be found below.
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-corecurl -s https://github.com/dossy/homebrew-core/commit/b75fe286f79e2b89548c5ed1bbe1958313c5c103.patch | patch -p1brew reinstall php --build-from-source
The specific source of issue appears to be that the libxml2 library is needed to replace Mac's built-in libcurl, which is what ultimately forces PHP's dependency on SecureTransport. These two lines in php.rb were the critical part of the fix for my purposes:
- depends_on "libxml2"
- --with-libxml-dir=#{Formula["libxml2"].opt_prefix}
For my specific circumstance I had to reset my editted home brew formula (php.rb) to the source because I had previously editted it. As a result applying the patch didn't work at first. If you've also editted your php.rb formula then I'd reset it to the source: https://raw.githubusercontent.com/Homebrew/homebrew-core/master/Formula/php.rb.
In the linked article on medium.com dossy suggests the follow command to build after applying to patch, brew install php --build-from-source. If you already have PHP installed you'll need to use reinstall in place of install instead.
You can use basic PHP to do this. Each image begins with a repeatable HTML pattern, so just count the occurrences with substr_count():
$image_count = substr_count( get_the_content(), '<img' );
That will give you the number of <img>'s in the post.
Google's "PHP Quick Start" documentation for the Sheet API seems to be out of date at https://developers.google.com/sheets/api/quickstart/php.
To get their demo working with PHP 7.2+ I had to modify quite a bit, and it's not all that clear what's going on. Below is a commented, updated version of their quick start that may be helpful to anyone else having trouble working with the Google Sheets API and PHP.
<?php
/**
* Updated Google Sheets Quickstart
*
* https://developers.google.com/sheets/api/quickstart/php
*/
require __DIR__ . '/vendor/autoload.php';
/**
* Appends one slash at the end, and removes any extra slashes
* https://stackoverflow.com/a/9339669/812973
*
* @return string $path with the slash appended
*/
function addTrailingSlash ($path)
{
return rtrim ($path, '/') . '/';
}
/**
* Returns an authorized API client.
* @return Google_Client the authorized client object
*/
function getClient() {
// Change this to a secure location where you'll save your config *.json files
// Make sure it isn't publicly available on the web
$configPath = addTrailingSlash (getcwd());
// This get's generated by the script, so don't create it
$credentialsPath = $configPath . 'credentials.json';
$client = new Google_Client();
// Matches the "Application Name" you enter during the "Step 1" wizard
$client->setApplicationName( 'API App Name' );
$client->setScopes( Google_Service_Sheets::SPREADSHEETS_READONLY );
// You need to go through "Step 1" steps to generate this file: https://developers.google.com/sheets/api/quickstart/php
$client->setAuthConfig( $configPath . 'client_secret.json' );
$client->setAccessType( 'offline' );
// This must match the "callback URL" that you enter under "OAuth 2.0 client ID" in the Google APIs console at https://console.developers.google.com/apis/credentials
$client->setRedirectUri( 'https://' . $_SERVER['HTTP_HOST'] . '/' . basename( __FILE__, '.php' ) );
// We have a stored credentials file, try using the data from there first
if ( file_exists( $credentialsPath ) ) {
$accessToken = json_decode( file_get_contents( $credentialsPath ), true );
}
// No stored credentials found, we'll need to request them with OAuth
else {
// Request authorization from the user
$authUrl = $client->createAuthUrl();
if ( ! isset( $_GET['code'] ) ) {
header( "Location: $authUrl", true, 302 );
exit;
}
// The authorization code is sent to the callback URL as a GET parameter.
// We use this "authorization code" to generate an "access token". The
// "access token" is what's effectively used as a private API key.
$authCode = $_GET['code'];
$accessToken = $client->fetchAccessTokenWithAuthCode( $authCode );
// Create credentials.json if it doesn't already exist (first run)
if ( ! file_exists( dirname( $credentialsPath ) ) ) {
mkdir( dirname( $credentialsPath ), 0700, true );
}
// Save the $accessToken object to the credentials.json file for re-use
file_put_contents( $credentialsPath, json_encode( $accessToken ) );
}
// Provide client with API access token
$client->setAccessToken( $accessToken );
// If the $accessToken is expired then we'll need to refresh it
if ( $client->isAccessTokenExpired() ) {
$client->fetchAccessTokenWithRefreshToken( $client->getRefreshToken() );
file_put_contents( $credentialsPath, json_encode( $client->getAccessToken() ) );
}
return $client;
}
// Get the API client and construct the service object.
$client = getClient();
$service = new Google_Service_Sheets( $client );
// Get values from a spreadheet and print
// https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get
$spreadsheetId = '1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms';
$range = 'Class Data!A2:E';
$response = $service->spreadsheets_values->get($spreadsheetId, $range);
$values = $response->getValues();
if (empty($values)) {
print "No data found.\n";
} else {
print "Name, Major:\n";
foreach ($values as $row) {
// Print columns A and E, which correspond to indices 0 and 4.
printf("%s, %s\n", $row[0], $row[4]);
}
}
Addclass dont work with angular directive
Use attributes.$addClass() in place of element.addClass() inside of your $scope.$watch() method.
If you take a look at the AngularJS source for [ng-class], for some reason they don't use element.addClass() and instead use this approach.
I can't quite explain why this works exactly, but I do know that it will solve this issue specifically.
For reference, here's the source to AngularJS's [ng-class]:
https://github.com/angular/angular.js/blob/master/src/ng/directive/ngClass.js
PHP 7.2 cURL with OpenSSL not SecureTransport
I have a local PHP install on a Mac that out of the box uses cURL 7.54.0 w/SecureTransport for SSL. I need to switch this to use a version of cURL that uses OpenSSL for SSL. Here's what I've done so far:
- Install OpenSSL using brew:
brew install openssl - Install cURL with OpenSSL using brew:
brew install curl --with-openssl - Reinstall PHP from the source with the
--with-curl=/usr/local/opt/curloption set. This path is the cURL with OpenSSL, the built-in one exists.
Based on what I've researched, this should be the solution, but when I open up phpinfo() PHP is still using the old curl 7.54.0 w/SecureTransport. The Configure Command secure shows that '--with-curl=/usr/local/opt/curl' was properly set during the configure process.
Down under http I do see something interesting going on with libcurl:
Used Library Compiled Linked
libcurl 7.59.0 7.54.0
I have no idea how to adjust the Linked item shown here, or if this will even fix the issue. I'm completely stumped, any help is extremely appreciated.
Home Brew PHP 7.2.5 Install with cURL
I have a localhost development environment on my Mac that uses homebrew's php formula and I'm pulling my hair out trying to install with a custom path to cURL rather than the default Mac OS version (v7.54.0) that uses SecureTransport for SSL. SecureTransport causes a lot of issues with SSL requests to remote services, so OpenSSL is pretty much a requirement for my purposes.
Here's the process I've taken so far:
- Installed curl through home brew with OpenSSL:
brew install curl --with-openssl - Edited brew's
phpformula to modify the compile process, telling./configureto use the brew installed curl (v7.59.0). I've tried--with-curl=/usr/local/Cellar/curl/7.59.0and also--with-curl=#{Formula["curl"].opt_prefix}. The second option is just a dynamic symlink to the former. - Save the edits and rebuild php from the source:
brew reinstall --build-from-source php
To verify that I have the write ./configure options I added a temporary line to my Brew formula edits that spits out the args passed. Here's what this looks like:
--prefix=/usr/local/Cellar/php/7.2.5
--localstatedir=/usr/local/var
--sysconfdir=/usr/local/etc/php/7.2
--with-config-file-path=/usr/local/etc/php/7.2
--with-config-file-scan-dir=/usr/local/etc/php/7.2/conf.d
--with-pear=/usr/local/Cellar/php/7.2.5/share/php/pear
--enable-bcmath
--enable-calendar
--enable-dba
--enable-dtrace
--enable-exif
--enable-ftp
--enable-fpm
--enable-intl
--enable-mbregex
--enable-mbstring
--enable-mysqlnd
--enable-opcache-file
--enable-pcntl
--enable-phpdbg
--enable-phpdbg-webhelper
--enable-shmop
--enable-soap
--enable-sockets
--enable-sysvmsg
--enable-sysvsem
--enable-sysvshm
--enable-wddx
--enable-zip
--with-apxs2=/usr/local/opt/httpd/bin/apxs
--with-bz2
--with-curl=/usr/local/Cellar/curl/7.59.0
--with-fpm-user=_www
--with-fpm-group=_www
--with-freetype-dir=/usr/local/opt/freetype
--with-gd
--with-gettext=/usr/local/opt/gettext
--with-gmp=/usr/local/opt/gmp
--with-icu-dir=/usr/local/opt/icu4c
--with-jpeg-dir=/usr/local/opt/jpeg
--with-kerberos
--with-layout=GNU
--with-ldap
--with-ldap-sasl
--with-libedit
--with-libzip
--with-mhash
--with-mysql-sock=/tmp/mysql.sock
--with-mysqli=mysqlnd
--with-ndbm
--with-openssl=/usr/local/opt/openssl
--with-password-argon2=/usr/local/opt/argon2
--with-pdo-dblib=/usr/local/opt/freetds
--with-pdo-mysql=mysqlnd
--with-pdo-odbc=unixODBC,/usr/local/opt/unixodbc
--with-pdo-pgsql=/usr/local/opt/libpq
--with-pgsql=/usr/local/opt/libpq
--with-pic
--with-png-dir=/usr/local/opt/libpng
--with-pspell=/usr/local/opt/aspell
--with-sodium=/usr/local/opt/libsodium
--with-unixODBC=/usr/local/opt/unixodbc
--with-webp-dir=/usr/local/opt/webp
--with-xmlrpc
--with-xsl
--with-zlib
By all intensive purposes this should be working, but when I open up a phpinfo() after reinstalling php from the source I'm seeing the following under the Configure Command value:
'./configure'
'--prefix=/usr/local/Cellar/php/7.2.5'
'--localstatedir=/usr/local/var'
'--sysconfdir=/usr/local/etc/php/7.2'
'--with-config-file-path=/usr/local/etc/php/7.2'
'--with-config-file-scan-dir=/usr/local/etc/php/7.2/conf.d'
'--with-pear=/usr/local/Cellar/php/7.2.5/share/php/pear'
'--enable-bcmath'
'--enable-calendar'
'--enable-dba'
'--enable-dtrace'
'--enable-exif'
'--enable-ftp'
'--enable-fpm'
'--enable-intl'
'--enable-mbregex'
'--enable-mbstring'
'--enable-mysqlnd'
'--enable-opcache-file'
'--enable-pcntl'
'--enable-phpdbg'
'--enable-phpdbg-webhelper'
'--enable-shmop'
'--enable-soap'
'--enable-sockets'
'--enable-sysvmsg'
'--enable-sysvsem'
'--enable-sysvshm'
'--enable-wddx'
'--enable-zip'
'--with-apxs2=/usr/local/opt/httpd/bin/apxs'
'--with-bz2'
'--with-fpm-user=_www'
'--with-fpm-group=_www'
'--with-freetype-dir=/usr/local/opt/freetype'
'--with-gd'
'--with-gettext=/usr/local/opt/gettext'
'--with-gmp=/usr/local/opt/gmp'
'--with-icu-dir=/usr/local/opt/icu4c'
'--with-jpeg-dir=/usr/local/opt/jpeg'
'--with-kerberos'
'--with-layout=GNU'
'--with-ldap'
'--with-ldap-sasl'
'--with-libedit'
'--with-libzip'
'--with-mhash'
'--with-mysql-sock=/tmp/mysql.sock'
'--with-mysqli=mysqlnd'
'--with-ndbm'
'--with-openssl=/usr/local/opt/openssl'
'--with-password-argon2=/usr/local/opt/argon2'
'--with-pdo-dblib=/usr/local/opt/freetds'
'--with-pdo-mysql=mysqlnd'
'--with-pdo-odbc=unixODBC,/usr/local/opt/unixodbc'
'--with-pdo-pgsql=/usr/local/opt/libpq'
'--with-pgsql=/usr/local/opt/libpq'
'--with-pic'
'--with-png-dir=/usr/local/opt/libpng'
'--with-pspell=/usr/local/opt/aspell'
'--with-sodium=/usr/local/opt/libsodium'
'--with-unixODBC=/usr/local/opt/unixodbc'
'--with-webp-dir=/usr/local/opt/webp'
'--with-xmlrpc'
'--with-xsl'
'--with-zlib'
'--with-curl'
If you notice, there's a trailing --with-curl at the tail of this, while everything else is in the order that's defined in the brew formula. I have no idea where or how this is appended onto the ./configure command, but this may be related to the cause of the issue.
For reference, here's the exact content of the modified php.rb formula for Brew:
https://gist.github.com/Kevinlearynet/a44ffa2107a1b6e09935766a9e46cfd4
Either way, I'm completely stumped here. Any help or assistance is very much appreciated.
Here's a real-world example I use all the time to do this without the need for any additional packages. I use this to minify, rename and compile any .js file in the js directory. Compiled files are saved to a dist directory with .min appended before the extension.
// Compile JS
var compileJS = function( file ) {
var currentDirectory = process.cwd() + '/';
var modifiedFile = file.path.replace( currentDirectory, '' );
gulp.src( modifiedFile )
.pipe( uglify() )
.pipe( rename( {
suffix: ".min"
} ) )
.pipe( livereload() )
.pipe( gulp.dest( 'dist' ) );
};
// Watch for changes
gulp.watch( 'js/*.js', [ 'js' ] ).on( "change", compileJS );
The above answers seemed partially incomplete and a little unclear to me, hopefully this is helpful for anyone else looking for a basic example.
Installing node with brew fails on Mac OS Sierra
This was triggered for me after a brew upgrade and brew update ran. I was able to fix it by simply re-installing the two items flagged as problems (which made sense to me):
brew reinstall node
brew reinstall icu4c
One useful addition here: there's a hidden debugging tool that the Google dev team provides when #google-wcc-debug is added to the URL.
Just add the hash to the URL where you want to test this, hit enter and then refresh the page. You should see a dialog appear at the bottom of the page with a FORCE button in the upper right. Clicking this button will force a phone swap with the number 99999999, which is really helpful for testing.
How can I enable / disable a button to validate a form where there is an ng-repeat?
I'd suggest using AngularJS's built-in form validation rather than HTML5's. To handle the repeated fields <ng-form> is perfect, allowing you to isolate the scope and provide individual validation messages where appropriate. This will also let you use a single submit button if you want, allowing users to submit all of the votes at once rather than one by one.
<section ng-controller="Channels">
<form name="candidatesForm" novalidate>
<ng-form ng-repeat="user in aCandidatos" name="voteForm">
<label>{{ user.nombre }}s Votos</label>
<input type="text" class="form-control" name="votos" ng-model="user.votos" required>
<p class="help-block text-danger" ng-show="voteForm.votos.$invalid">Votos is required.</p>
</ng-form>
<button type="submit" ng-disabled="candidatesForm.$invalid">Send</button>
</form>
</section>
Here are a few additional details on the specific changes I've added here and why:
novalidateadded to the form disabled the default HTML5 handling of validation- Giving a form a name provides us with AngularJS's built-in form validation on the $scope
<ng-form>let's us create isolated scope's for each repeated form, letting us validation them individually- Add
type="submit"to the button will trigger a proper form submit
I see this from time to time with premium plugins and themes that require an activation key. The WP UI won't provide anyway to update the plugin or theme, but you'll see the pending update count number in the UI.
To track down the source I use the following function:
/**
* Debug Pending Updates
*
* Crude debugging method that will spit out all pending plugin
* and theme updates for admin level users when ?debug_updates is
* added to a /wp-admin/ URL.
*/
function debug_pending_updates() {
// Rough safety nets
if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) return;
if ( ! isset( $_GET['debug_updates'] ) ) return;
$output = "";
// Check plugins
$plugin_updates = get_site_transient( 'update_plugins' );
if ( $plugin_updates && ! empty( $plugin_updates->response ) ) {
foreach ( $plugin_updates->response as $plugin => $details ) {
$output .= "<p><strong>Plugin</strong> <u>$plugin</u> is reporting an available update.</p>";
}
}
// Check themes
wp_update_themes();
$theme_updates = get_site_transient( 'update_themes' );
if ( $theme_updates && ! empty( $theme_updates->response ) ) {
foreach ( $theme_updates->response as $theme => $details ) {
$output .= "<p><strong>Theme</strong> <u>$theme</u> is reporting an available update.</p>";
}
}
if ( empty( $output ) ) $output = "No pending updates found in the database.";
wp_die( $output );
}
add_action( 'init', 'debug_pending_updates' );
Add that to your theme's functions.php file then visit a page with ?debug_updates added to the URL. For example: yourdomain.example/wp-admin/?debug_updates. This should show you any theme or plugin that's causing the issue.
Because the SVG is dynamically loaded you need to load the stylesheet from within the SVG itself. Try adding this to your SVG:
<?xml-stylesheet href="anim.css" type="text/css"?>
Where anim.css is the stylesheet where your CSS3 animations are defined.
An updated answer here as of 2017, should anyone need it, is that onhashchange is well supported in all major browsers. See caniuse for details. To use it with jQuery no plugin is needed:
$( window ).on( 'hashchange', function( e ) {
console.log( 'hash changed' );
} );
Occasionally I come across legacy systems where hashbang URL's are still used and this is helpful. If you're building something new and using hash links I highly suggest you consider using the HTML5 pushState API instead.
Here's a Lodash solution to this that works for flat key => value object, rather than a nested object. The accepted answer's suggestion to use _.findKey works for objects with nested objects, but it doesn't work in this common circumstance.
This approach inverts the object, swapping keys for values, and then finds the key by looking up the value on the new (inverted) object. If the key isn't found then false is returned, which I prefer over undefined, but you could easily swap this out in the third parameter of the _.get method in getKey().
// Get an object's key by value
var getKey = function( obj, value ) {
var inverse = _.invert( obj );
return _.get( inverse, value, false );
};
// US states used as an example
var states = {
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
"DC": "District Of Columbia",
"FM": "Federated States Of Micronesia",
"FL": "Florida",
"GA": "Georgia",
"GU": "Guam",
"HI": "Hawaii",
"ID": "Idaho",
"IL": "Illinois",
"IN": "Indiana",
"IA": "Iowa",
"KS": "Kansas",
"KY": "Kentucky",
"LA": "Louisiana",
"ME": "Maine",
"MH": "Marshall Islands",
"MD": "Maryland",
"MA": "Massachusetts",
"MI": "Michigan",
"MN": "Minnesota",
"MS": "Mississippi",
"MO": "Missouri",
"MT": "Montana",
"NE": "Nebraska",
"NV": "Nevada",
"NH": "New Hampshire",
"NJ": "New Jersey",
"NM": "New Mexico",
"NY": "New York",
"NC": "North Carolina",
"ND": "North Dakota",
"MP": "Northern Mariana Islands",
"OH": "Ohio",
"OK": "Oklahoma",
"OR": "Oregon",
"PW": "Palau",
"PA": "Pennsylvania",
"PR": "Puerto Rico",
"RI": "Rhode Island",
"SC": "South Carolina",
"SD": "South Dakota",
"TN": "Tennessee",
"TX": "Texas",
"UT": "Utah",
"VT": "Vermont",
"VI": "Virgin Islands",
"VA": "Virginia",
"WA": "Washington",
"WV": "West Virginia",
"WI": "Wisconsin",
"WY": "Wyoming"
};
console.log( 'The key for "Massachusetts" is "' + getKey( states, 'Massachusetts' ) + '"' );
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js"></script>
get key corresponding to value in js object
If anyone is interested in a Lodash solution to this, here's one I commonly use. This method inverts the object, swapping keys for values, and then finds the key by looking up the value against this new object.
var inspectionMapping = {
'a_pillar_lh': "A Pillar LH",
'b_pillar_lh': "B Pillar LH"
};
var getKey = function( obj, value ) {
var inverse = _.invert( obj );
return _.get( inverse, value, false );
};
alert( 'The key for "A Pillar LH" is "' + getKey( inspectionMapping, 'A Pillar LH' ) + '"' );
<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.4/lodash.min.js"></script>
I think this provides a more thorough approach:
button, input[type="submit"], input[type="reset"] {
background: none;
color: inherit;
border: none;
padding: 0;
font: inherit;
cursor: pointer;
outline: inherit;
}
<button>Example</button>
Here's a way to handle this without jQuery using only an Angular directive. This example doesn't support decimals. It's easy to modify it to support that though, just change the $filter in the toView() function.
In my opinion this is a better approach to solve the same problem, as you can avoid loading in jQuery and the currency plugin mentioned by the author. Locale support for Euro should be supported by the use the $locale properties, but I've only tested this for use in USD.
(function() {
var app = angular.module('currencyMask', []);
// Controller
app.controller('ctrl', ['$scope', function($scope) {
$scope.amount = 100000;
}]);
// Directive
app.directive('inputCurrency', ['$locale', '$filter', function($locale, $filter) {
// For input validation
var isValid = function(val) {
return angular.isNumber(val) && !isNaN(val);
};
// Helper for creating RegExp's
var toRegExp = function(val) {
var escaped = val.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
return new RegExp(escaped, 'g');
};
// Saved to your $scope/model
var toModel = function(val) {
// Locale currency support
var decimal = toRegExp($locale.NUMBER_FORMATS.DECIMAL_SEP);
var group = toRegExp($locale.NUMBER_FORMATS.GROUP_SEP);
var currency = toRegExp($locale.NUMBER_FORMATS.CURRENCY_SYM);
// Strip currency related characters from string
val = val.replace(decimal, '').replace(group, '').replace(currency, '').trim();
return parseInt(val, 10);
};
// Displayed in the input to users
var toView = function(val) {
return $filter('currency')(val, '$', 0);
};
// Link to DOM
var link = function($scope, $element, $attrs, $ngModel) {
$ngModel.$formatters.push(toView);
$ngModel.$parsers.push(toModel);
$ngModel.$validators.currency = isValid;
$element.on('keyup', function() {
$ngModel.$viewValue = toView($ngModel.$modelValue);
$ngModel.$render();
});
};
return {
restrict: 'A',
require: 'ngModel',
link: link
};
}]);
})();
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.6.5/angular.min.js"></script>
<div ng-app="currencyMask" ng-controller="ctrl">
<input input-currency ng-model="amount">
<p><strong>Amount:</strong> {{ amount }}</p>
</div>
Lessons Learned from 10 Years as a Freelance Web Developer
"SyntaxError: Unexpected token < in JSON at position 0"
On a general level this error occurs when a JSON object is parsed that has syntax errors in it. Think of something like this, where the message property contains unescaped double quotes:
{
"data": [{
"code": "1",
"message": "This message has "unescaped" quotes, which is a JSON syntax error."
}]
}
If you have JSON in your app somewhere then it's good to run it through JSONLint to verify that it doesn't have a syntax error. Usually this isn't the case though in my experience, it's usually JSON returned from an API that's the culprit.
When an XHR request is made to an HTTP API that returns a response with a Content-Type:application/json; charset=UTF-8 header which contains invalid JSON in the response body you'll see this error.
If a server-side API controller is improperly handling a syntax error, and it's being printed out as part of the response, that will break the structure of JSON returned. A good example of this would be an API response containing a PHP Warning or Notice in the response body:
<b>Notice</b>: Undefined variable: something in <b>/path/to/some-api-controller.php</b> on line <b>99</b><br />
{
"success": false,
"data": [{ ... }]
}
95% of the time this is the source of the issue for me, and though it's somewhat addressed here in the other responses I didn't feel it was clearly described. Hopefully this helps, if you're looking for a handy way to track down which API response contains a JSON syntax error I've written an Angular module for that.
Here's the module:
/**
* Track Incomplete XHR Requests
*
* Extend httpInterceptor to track XHR completions and keep a queue
* of our HTTP requests in order to find if any are incomplete or
* never finish, usually this is the source of the issue if it's
* XHR related
*/
angular.module( "xhrErrorTracking", [
'ng',
'ngResource'
] )
.factory( 'xhrErrorTracking', [ '$q', function( $q ) {
var currentResponse = false;
return {
response: function( response ) {
currentResponse = response;
return response || $q.when( response );
},
responseError: function( rejection ) {
var requestDesc = currentResponse.config.method + ' ' + currentResponse.config.url;
if ( currentResponse.config.params ) requestDesc += ' ' + JSON.stringify( currentResponse.config.params );
console.warn( 'JSON Errors Found in XHR Response: ' + requestDesc, currentResponse );
return $q.reject( rejection );
}
};
} ] )
.config( [ '$httpProvider', function( $httpProvider ) {
$httpProvider.interceptors.push( 'xhrErrorTracking' );
} ] );
More details can be found in the blog article referenced above, I haven't posted everything found there here as it's probably not all relevant.
This can be done well with an external library called decimal.js that provides a Decimal type for JavaScript. It's also available for Node on npm. Below is an example that replicates the original example from gustavomanolo using decimal.js.
// Decimal type provided by decimal.js (http://mikemcl.github.io/decimal.js/)
var m1 = new Decimal( 2232.00 );
var percent = new Decimal( 10/100 );
var total = m1.mul(percent);
console.log( 'Total:', total );
<script src="https://cdnjs.cloudflare.com/ajax/libs/decimal.js/7.2.3/decimal.min.js"></script>
I'm pretty sure I had the exact same use case as Sahat, here's the syntax I used for configuring two routes to handle /api matches and misses in Express.js:
// /api/* Matches
app.get( '^/api/:params*', function( req, res, next ) {
res.send( "Matches an /api/ route." );
} );
// /api/* Misses
app.get( /^((?!\/api\/).)*$/, function( req, res, next ) {
res.send( "NOT an /api/ route." );
} );
This assumes that all of your API routes follow a pattern of /api/*.
Static file loading with $translate is handled by an additional external *.js file that you need to load in. This contains the $translateStaticFilesLoader factory mentioned here.
You can manually copy in the factory like @ALoppu did, but a better approach is to actually load the external script right after angular-translate.js:
<script src="vendor/angular/angular-translate.min.js"></script>
<script src="vendor/angular/angular-translate-loader-static-files.min.js"></script>
You can get the latest copy of angular-translate-loader-static-files.min.js on GitHub here.
Given that this is 4 years old, and Lodash has more or less taken the place of Underscore, I thought I would share this solution using Lodash:
var keys = ['foo', 'bar', 'qux'];
var values = ['1', '2', '3'];
var obj = _.zipObject( keys, values );
Simple and clean.
This solved the issue for me:
-webkit-transform: translate3d(0,0,0);
Adding this rule turns the element into a layer in Chrome, which avoids repainting. In my unique situation the error was caused by browser re-painting.
I was able to solve this on OS X by shutting down the existing mysql.server that was running:
mysql.server stop
The starting:
mysql.server start
From there I could run mysql.server restart without throwing the ERROR.
You can also simplify this a bit by passing a null object to bind():
async.series( [
uploadImage.bind( null, path, destFolder, destination ),
ProcessUpload.bind( null, optionalController, opts, res )
] );
Lodash has a round method:
_.round(4.006);
// => 4
_.round(4.006, 2);
// => 4.01
_.round(4060, -2);
// => 4100
I think many of these answers span a few different versions of Sublime Text, here's how I do this with Sublime Text 3 on a Mac.
- Open the Sublime Text > Preferences > Settings - User menu
- Edit the
file_exclude_patternsandfolder_exclude_patternsvalues to ignore files and/or folders from the Find tool
Example
"file_exclude_patterns":
[
".svn",
".git",
".hg",
".md",
".txt",
".DS_Store"
],
"folder_exclude_patterns":
[
"node_modules",
"bower_components",
".svn",
".git",
".hg",
"CVS",
"deprecated",
"cache"
],
Screenshot
The CSS3 appearance property provides a simple way to style any element (including an anchor) with a browser's built-in <button> styles:
a.btn {
-webkit-appearance: button;
-moz-appearance: button;
appearance: button;
}
<body>
<a class="btn">CSS Button</a>
</body>
CSS Tricks has a nice outline with more details on this. Keep in mind that no version of Internet Explorer currently supports this according to caniuse.com.
The promise() method is usually for AJAX, but it can be used with each() to achieve what you want:
$('.element').each(function (key, val) {
console.log('Do something to each individual .element');
}).promise().done(function () {
console.log('Did things to every .element, all done.');
});
If want a basic way to generate a timestamp in Node.js this works well.
var time = process.hrtime();
var timestamp = Math.round( time[ 0 ] * 1e3 + time[ 1 ] / 1e6 );
Our team is using this to bust cache in a localhost environment. The output is /dist/css/global.css?v=245521377 where 245521377 is the timestamp generated by hrtime().
Hopefully this helps, the methods above can work as well but I found this to be the simplest approach for our needs in Node.js.
You can do this by intercepting the onhashchange event and adjusting the offset of the window:
(function($){
if ( "onhashchange" in window ) {
var hashHandler = function(){
var hash = window.location.hash.substring( 1 );
if ( !hash )
return;
var offset = 50;
var sel = '[id="' + hash + '"], a[name="' + hash + '"]';
var currentOffset = $( sel ).offset().top;
$( window ).scrollTop( currentOffset + offset );
};
window.addEventListener("hashchange", hashHandler, false);
window.addEventListener("load", hashHandler, false);
}
})(window.jQuery);
Femi's approach is great, but if your goal is to work with WP_Query data inside of a JS file then I'd suggest checking out the wp_localize_script function.
/**
* WP_Query as JSON
*/
function kevinlearynet_scripts() {
// custom query
$posts = new WP_Query( array(
'category__in' => 4,
'meta_key' => 'meta_long',
) );
// to json
$json = json_decode( json_encode( $posts ), true );
// enqueue our external JS
wp_enqueue_script( 'main-js', plugins_url( 'assets/main.min.js', __FILE__ ), array( 'jquery' ) );
// make json accesible within enqueued JS
wp_localize_script( 'main-js', 'customQuery', $json );
}
add_action( 'wp_enqueue_scripts', 'kevinlearynet_scripts' );
This will create the window.customQuery object in main.min.js.
@sebarmeli's approach is the best in my opinion, but if you only want data to persist for the life of a session then sessionStorage is probably a better option:
This is a global object (sessionStorage) that maintains a storage area that's available for the duration of the page session. A page session lasts for as long as the browser is open and survives over page reloads and restores. Opening a page in a new tab or window will cause a new session to be initiated.
This answer may not be as specific as you would like, but I'd suggest looking at the good package that's part of Walmart's hapi.js framework. It does a great job of extending logging beyond --trace-gc. It's a process monitor that listens for one or more of the following events:
ops- System and process performance - CPU, memory, disk, and other metrics.response- Information about incoming requests and the response. This maps to either the "response" or "tail" event emitted from hapi servers.log- logging information not bound to a specific request such as system errors, background processing, configuration errors, etc. Maps to the "log" event emitted from hapi servers.error- request responses that have a status code of 500. This maps to the "request-error" hapi event.request- Request logging information. This maps to the hapi 'request' event that is emitted viarequest.log().
You would have to pull in the Hapi libary for this to work, but it may be worth it temporarily for the purposes of debugging. In general I highly recommend Hapi for scaling Node.js apps, the guys at Walmart have been doing amazing things with it over the past year.
Could you use the file-type package to detect the file type by checking the magic number of the buffer?
Install
npm install --save file-type
Usage
var fileType = require('file-type');
var safeTypes = ['image/gif'];
var request = https.request(options, function (response) {
var chunks = [];
response.on('data', function (chunk) {
chunks.push(chunk);
});
response.on('end', function () {
var buffer = Buffer.concat(chunks);
var file = fileType(buffer) );
console.log( file );
//=> { ext: 'gif', mime: 'image/gif' }
// mime isn't safe
if ( safeTypes.indexOf(file.mime) == '-1' ) {
// do your Base64 thing
}
});
});
...
request.end();
...
If you want to keep your code package free have a look at the package source on Github, it's pretty minimal.
Marciej's approach worked for me:
nodemon -e js,html
You can also configure this in a nodemon.json config file. Here's how we're currently using it:
{
"execMap": {
"js": "node --harmony"
},
"script": "server.js",
"ext": "js html"
}
I prefer this selector myself, it protects against false positives for absolute links that point to your site (like those often generated by a CMS system).
var currentDomain = document.location.protocol + '//' + document.location.hostname;
var outboundLinks = 'a[href^="http"]:not([href*="' + currentDomain + '"])';
Here's the use case where this worked for me, for context:
var currentDomain = document.location.protocol + '//' + document.location.hostname;
$('a[href^="http"]:not([href*="' + currentDomain + '"])').on('click', function (e) {
e.preventDefault();
// track GA event for outbound links
if (typeof _gaq == "undefined")
return;
_gaq.push(["_trackEvent", "outbound", this.href, document.location.pathname + document.location.search]);
});
You could handle this using $scope methods to define those dynamic class names. This would look something like this:
Controller:
$scope.selectedCol = 3;
$scope.key = 3;
// dynamic ng-class values
$scope.selectedHeader = function () {
if ($scope.selectedCol === $scope.key)
return 'header-selected';
else
return false;
};
// selected header definition for ng-class
$scope.headerKey = function () {
return 'header-' + $scope.key;
};
View:
<header ng-class="[ selectedHeader(), headerKey() ]">
<h1>Header element</h1>
</header>
Result:
<header ng-class="[ selectedHeader(), headerKey() ]" class="header-selected header-3">
<h1>Header element</h1>
</header>
The accepted answer here does not work if you have inline scripts in your document. To avoid this you can use the following to only target <script> tags with a [src] attribute.
/**
* Current Script Path
*
* Get the dir path to the currently executing script file
* which is always the last one in the scripts array with
* an [src] attr
*/
var currentScriptPath = function () {
var scripts = document.querySelectorAll( 'script[src]' );
var currentScript = scripts[ scripts.length - 1 ].src;
var currentScriptChunks = currentScript.split( '/' );
var currentScriptFile = currentScriptChunks[ currentScriptChunks.length - 1 ];
return currentScript.replace( currentScriptFile, '' );
}
This effectively captures the last external .js file, solving some issues I encountered with inline JS templates.
I believe console.dir() is what you're looking for:
https://developer.mozilla.org/en-US/docs/Web/API/Console.dir
The only downside is it doesn't allow for labeling each object that's output, and it's also a non-standard console method.
You'll need to configure opendiff as your global merge.tool:
# locate xcode utilities
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
# set "opendiff" as the default mergetool globally
git config --global merge.tool opendiff
If you get Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo, opening XCode and accepting the license fixes the issue
That VIP plugin doesn't support post_type values beyond "post" by default, but this handy function should solve it for you:
/**
* Add Bitly to CPT's
*/
function my_add_bitly_cpts( $post_types ) {
$post_types[] = 'my_custom_post_type_name';
return $post_types;
}
add_filter( 'bitly_post_types' , 'my_add_bitly_cpts' );
Bulk REST API POST Processing
I'm migrating 40,000 records from one system to another, and the only way to import data into the receiving system is via rest API POST calls.
I'm looking for advice on the fastest approach to iterate through 40,000 REST API calls. I have the data I need to transfer formatted as JSON, and I've chunked the objects into 40+ .json files using PHP. Ideally I'd like to handle the POST's asynchronously if possible, any advice on approaches using PHP, JavaScript, Node.js or bash would be tremendously helpful.
Testing download links with Nightwatch.js
I'm attempting to build an automated test with Nightwatch.js in order to verify that software download links are working correctly. I don't want to download the files, as they are quite large, I just want to verify that the corresponding link is returning a 200 HTTP response to make sure the links are pointing to the proper place.
Any idea for ways to test links to downloadable files with Nightwatch.js?
Here's what I currently have:
/**
* Test Software Downloads
*
* Verify that software downloads are working
*/
module.exports = {
"Download redirect links": function (browser) {
// download links
var downloadLinks = {
"software-download-latest-mac": "http://downloads.company.com/mac/latest/",
"software-download-latest-linux": "http://downloads.company.com/linux/latest/",
"software-download-latest-win32": "http://downloads.company.com/windows/32/latest/",
"software-download-latest-win64": "http://downloads.company.com/windows/64/latest/"
};
// loop through download links
for (var key in downloadLinks) {
if (downloadLinks.hasOwnProperty(key)) {
// test each link's status
browser
.url(downloadLinks[key]);
}
}
// end testing
browser.end();
}
};
I use the following code in my Browser Shots plugin, I think it's more or less what you're looking for.
/**
* TinyMCE Integration
*/
(function () {
"use strict";
if (typeof (tinymce) != "undefined") {
tinymce.create('tinymce.plugins.browsershots', {
init: function (ed, url) {
ed.addButton('browsershots', {
title: 'Browser Shots',
image: url.replace('/js', '/images') + '/browsershots-icon.png',
onclick: function () {
// Dialog prompt's
var width = prompt("Screenshot width:", "600");
var height = prompt("Screenshot height:", "450");
var website = prompt("What's the URL of the website?", "http://www.kevinleary.net");
// Build shortcode tag
if (website !== null && website !== '') {
var shortcode = '[browser-shot url="' + website + '"';
if (width !== null && width !== '') {
shortcode += ' width="' + width + '"';
} else if (height !== null && height !== '') {
shortcode += ' height="' + height + '"';
}
shortcode += ']';
ed.execCommand('mceInsertContent', false, shortcode);
}
}
});
},
createControl: function () {
return null;
},
getInfo: function () {
return {
longname: "Browser Shots",
author: 'Kevin Leary',
authorurl: 'http://www.kevinleary.net',
infourl: 'http://wordpress.org/extend/plugins/browser-shots/',
version: "1.2"
};
}
});
tinymce.PluginManager.add('browsershots', tinymce.plugins.browsershots);
}
})();
Try giving the body and html tags a min-height of 100%. If content doesn't fill the entire viewport, an absolute position set to bottom: 0 won't actually be at the bottom.
This solved the issue gracefully for me:
https://github.com/MoonScript/jQuery-ajaxTransport-XDomainRequest
Just install/compile after jQuery and before your script and use the $.ajax method as you normally would, the rest is handled behind the automatically.
Something like this works for me with the PHP2 SDK:
$aws_transfer = $s3->PutObject( array(
'Bucket' => 'bucket',
'Key' => $unique_file_name,
'Body' => \Guzzle\Http\EntityBody::factory( file_get_contents('http://www.example.com/file.flv') ),
) );
Extract Protected Request Response from AWS SDK for PHP
I'm working with the new Amazon ElasticTranscoder service, and am new to working with the AWS-SDK. I have a successful script created that runs a createJob request, transcoding an Amazon S3 file from one format to another.
The problem is, I can't seem to access the response $data that is returned when the request is made. I can see it, and it contains the information I need, but I receive this error when I attempted to store it:
Fatal error: Cannot access protected property Guzzle\Service\Resource\Model::$data
Here's what my request looks like:
<?php
// Include the SDK
require 'aws.phar';
use Aws\ElasticTranscoder\ElasticTranscoderClient;
// Setup the trancoding service tool(s)
$client = ElasticTranscoderClient::factory( array(
'key' => 'XXXXXXXXX',
'secret' => 'XXXXXXXXX',
'region' => 'us-east-1'
) );
// Create a new transcoding job
$file_name = '1362761118382-lqg0CvC1Z1.mov';
$file_name_explode = explode( '.', $file_name );
$webm_transcode_request = $client->createJob( array(
'PipelineId' => '1362759955061-7ad779',
'Input' => array(
'Key' => $file_name,
'FrameRate' => 'auto',
'Resolution' => 'auto',
'AspectRatio' => 'auto',
'Interlaced' => 'auto',
'Container' => 'auto',
),
'Output' => array(
'Key' => $file_name_explode[0] . '.webm',
'ThumbnailPattern' => $file_name_explode[0] . '-thumb-{resolution}-{count}',
'Rotate' => '0',
'PresetId' => '1363008701532-b7d529' // BenchFly MP4
)
) );
// Print the response data
echo '<pre>';
var_dump( $webm_transcode_request->data );
echo '</pre>';
?>
I've been banging my head against the wall trying to find some documentation on handling response requests with PHP and the AWS SDK, any help is very much appreciated.
You can track VideoJS 3.2 video events in Google Analytics using the following API customization's:
// Once the video is ready
_V_("video-embed-1234").ready(function(){
// Google Analytics event tracking
var trackGaEvent = function() {
var playerState = this;
// Determine time
var date = new Date( event.timeStamp );
var hours = date.getHours();
if ( hours < 10 ) hours = "0" + hours.toString();
var minutes = date.getMinutes();
if ( minutes < 10 ) minutes = "0" + minutes.toString();
var seconds = date.getSeconds();
if ( seconds < 10 ) seconds = "0" + seconds.toString();
var formattedTime = hours + ':' + minutes + ':' + seconds;
// Log event
var gaCategory = 'VideoJS';
var videoId = playerState.id;
var playerStateUrl = videoId.replace('benchfly-embed-', 'https://secured.benchfly.com/player/') + '/';
_gaq.push([ '_trackEvent', gaCategory, event.type, playerStateUrl, formattedTime, false ]);
};
// Attach GA tracking to event listeners
this.addEvent( "play", trackGaEvent );
this.addEvent( "pause", trackGaEvent );
this.addEvent( "load", trackGaEvent );
this.addEvent( "ended", trackGaEvent );
this.addEvent( "volumechange", trackGaEvent );
});
Complex Array Comparison in PHP
I'm programming a PHP quiz application and am having some trouble with the scoring mechanism. Specifically, I have 2 arrays that I'm comparing to determine if an answer is correct or not.
I want to verify that all values of one array are found in another array. For example, if the correct answer
Array
(
[0] => Proprietary user community
[1] => Surveys
[2] => Voice
[3] => Online chat
[4] => Web
[5] => Email
[6] => Social media
)
And the user provided answer is:
Array
(
[0] => Surveys
[4] => Online chat
[6] => Email
)
The system return incorrect, because all correct values have not been provided. Similarly, if the user provided answer looks like this:
Array
(
[0] => Proprietary user community
[1] => Surveys
[2] => Voice
[3] => Online chat
[4] => Web
[5] => Email
[6] => Social media
[7] => Phone
[8] => Live chat
)
The the answer would be correct, if though additional answers have been provided.
Any ideas? I've been thinking of using array_intersect() but there has to be a more elegant solution.
Any help is much appreciated!
Curated Web Design Resources
A weekly publication of hand picked, popular web design and development articles from around the web.
Trouble With Dust.js Logic Helpers
I'm working with jQuery 1.8.2 & Dust.js v1.1.1 for MVC-style templating within a JavaScript app. When I use the {@gt} logic helper I receive the following console error:
Uncaught TypeError: Cannot read property 'gt' of undefined
I believe the proper syntax is used in my template:
<ul class="listview">
{#seasons}
<li>
<h3>{name}</h3>
<p class="desc">{id}</p>
{@gt key="months" value="0"}
<span class="count">{months}</span>
{/gt}
</li>
{/seasons}
</ul><!--// end .listview -->
Here's the JSON structure:
{
"seasons":[
{
"name":"Spring",
"id":"weklv7",
"months": 8
},
{
"name":"Summer",
"id":"lvuec5",
"months": 4
}
]
}
If I remove the {@gt} logic helper from the template, the error disappears and the template is loaded correctly as HTML. For example:
<ul class="listview">
{#seasons}
<li>
<h3>{name}</h3>
<p class="desc">{id}</p>
<span class="count">{months}</span>
</li>
{/seasons}
</ul><!--// end .listview -->
Any help is much appreciated, thanks!
I've hit the same issue with a job search application I'm in the process of building. The h5Validate plugin solved this exact problem. It plugins in the HTML5 validation holes for many browsers and devices:
- Desktop: IE 9, 8, 7, 6, Chrome, Firefox, Safari, and Opera. Tested on Windows 7 and Mac.
- Mobile: iPhone, Android, Palm WebOS
If you've ever used the jQuery validation plugin, it's very similar. Think of it as an extension for HTML5 forms.
Oracle VirtualBox works very well. Working with it is pretty basic, and best of all it's free:
- Download Oracle VirtualBox
- Install Internet Explorer
- Open Oracle VirtualBox
- Done!
For detailed instructions reference this Internet Explorer mac testing guide. There's no point in reposting everything here it's kind of detailed.
I've had trouble with this for a while, it's so hard to get an accurate high quality screenshot generated. I've just released a stable plugin for handling this, it makes the process of automatically generating website screenshots in WordPress dead simple with a simple shortcode:
[browser-shot url="http://link-to-website" width="600"]
For more info checkout the official plugin page: http://wordpress.org/extend/plugins/browser-shots/
Running a virtual machine with VirtualBox is the best way I have found to reliably test websites on multiple versions of Internet Explorer with Mac OS X:
http://blog.openviewpartners.com/internet-explorer-mac-os-x/
This is much easier to do in WordPress 3.3 using the wp_editor() function.
I'm working on a plugin that will add a TinyMCE instance to a theme options page. Here's what it looks like:
// Add TinyMCE visual editor
wp_editor( $content, $id );
Where $content is the stored content and $id is the name of the field. Options can also be passed to customize the TinyMCE functionality, check out the WordPress Codex for more details.
I was able to take webwires answer and get an object click working using the following.
// Podcast player GA event tracking
var podcast_player = $('object.podcast-player');
if( podcast_player.length > 0 )
{
podcast_player.live('mousedown',function(){
_gaq.push(['_trackEvent', 'Podcast', 'Play']);
});
}
I hope this helps someone else out there, thanks webwires.
mod_rewrite 301 redirect not working
I'm trying to set up a rewrite that will redirect this URL:
/video-2011.php?video=150
to this:
/video/150/freeform-title-text-here/
I have the rewrite working using this line in my HTACCESS:
RewriteRule ^video/([0-9]+)/(.*)$ video-2011.php?video=$1 [L]
But as soon I add R=301 into the mix, it breaks. Any ideas?
Here's the full HTACCESS when it breaks:
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteRule ^video/([0-9]+)/(.*)$ video-2011.php?video=$1 [R=301,L]
Any help is greatly appreciated, thanks!
You may want to consider bypassing the JavaScript for this altogether. There's a well known approach called faux column's that can achieve what you're looking for with CSS:
The trick is to use the onFinish callback function to trigger the validation for the form that is inside the Shadowbox. If you use an ID for your form like I did, shadowbox will actually create a duplicate copy of the form so you need to target the form within the shadowbox itself. I used #sb-player to do this.
HTML Shadowbox Link
<a href="#newsletter-signup-wrapper" class="newsletter-signup UniversLTStd-Cn">Newsletter Sign-up</a>
JavaScript/jQuery
$('a.newsletter-signup').click(function(){
Shadowbox.open({
width: 562,
height: 395,
player: 'inline',
content: this.href,
options: {
onFinish: function(){
$('#sb-player #newsletter-signup-form').validate();
}
}
});
return false;
});
HTML Form (hidden in footer)
<div id="newsletter-signup-wrapper">
<div id="newsletter-signup">
<form action="" id="newsletter-signup-form" target="_parent" method="POST">
<div class="gform_body">
<ul class="gform_fields">
<li class="gfield">
<label class="gfield_label" for="first_name">First Name <span class="gfield_required">*</span></label>
<div class="ginput_container">
<input class="medium required" id="first_name" maxlength="40" name="first_name" size="20" type="text" />
</div>
</li>
<li class="gfield">
<label class="gfield_label" for="last_name">Last Name <span class="gfield_required">*</span></label>
<div class="ginput_container">
<input class="medium required" id="last_name" maxlength="80" name="last_name" size="20" type="text" />
</div>
</li>
<li class="gfield">
<label class="gfield_label" for="email">Email <span class="gfield_required">*</span></label>
<div class="ginput_container">
<input class="medium required" id="email" maxlength="80" name="email" size="20" type="text" />
</div>
</li>
<li class="gfield">
<label class="gfield_label" for="company">Company <span class="gfield_required">*</span></label>
<div class="ginput_container">
<input class="medium required" id="company" maxlength="40" name="company" size="20" type="text" />
</div>
</li>
</ul>
</div>
<div class="gform_footer">
<input class="button" type="submit" name="submit" value="Sign-up!">
</div>
</form>
</div>
</div><!--// end #newsletter-signup-wrapper -->
I hope this helps, I'm happy to explain in more detail if needed.
Good solution Nick!
Various scripts have implemented fixes (like cycle), but currently the best option I've found for fixing the pixelated text during animations is exactly what nick recommends: Overlaying a DIV instead of fading the text itself.
Sorry I couldn't be of more help Sapphire, but thanks for reading!
In the Finder browse to the /Users/yourusername/Library/Application Support/Coda/Plug-ins folder and remove the .codaplugin files you want to uninstall. That's it.
Oh, and be sure to replace yourusername with your Mac account name, usually it's firstnamelastaname.
A simple solution for me was to set the CSS for the containing element of the modal window to:
position:fixed;
This worked in IE7+, for IE6 you may need the advanced methods above.
It's not the items that are the issue, it's actually the order that isn't stored.
The menu order is stored in the wp_posts table, under the menu_order field. This field isn't currently included in the WordPress XML Import/Export. There's a trouble ticket in the Trac project with a temporary patch to fix this if you need this immediately, I would suspect that this will be included in the next release:
- http://core.trac.wordpress.org/ticket/4024
- http://core.trac.wordpress.org/attachment/ticket/4024/wp-export-import.diff
I hope that helps!
I had this issue myself, and wrote some code to solve this for embedding the new Vimeo IFRAME'd videos based on an existing snippet I found. This will allow you to add URL parameters for WIDTH and HEIGHT on a fancybox by fancybox basis. If you don't add them the default will open an IFRAME with a height of 90% and 90%.
(function($){
$(function(){
// Fancybox: IFRAME
var fancybox_iframe = $('.fancybox-iframe');
if (fancybox_iframe.length > 0){
fancybox_iframe.each(function(index){
// Inline frame width param
if( $(this).attr('href').match(/width=[0-9]+/i) ){
var fWidth = parseInt($(this).attr('href').match(/width=[0-9]+/i)[0].replace('width=',''));
} else {
var fWidth = '90%';
}
// Inline frame height param
if( $(this).attr('href').match(/height=[0-9]+/i) ){
var fHeight = parseInt($(this).attr('href').match(/height=[0-9]+/i)[0].replace('height=',''));
} else {
var fHeight = '90%';
}
if(window.console&&window.console.log) {
console.log('fWidth #'+index+': '+fWidth);
console.log('fHeight #'+index+': '+fHeight);
}
$(this).fancybox({
'titlePosition' : 'inside',
'type' : 'iframe',
'autoScale' : true,
'padding' : '10',
'width' : fWidth,
'height' : fHeight,
'centerOnScroll' : true
});
});
}
});
})(jQuery);
To use this you would use the following:
<a href="http://player.vimeo.com/video/16429685?color=ffffff&width=800&height=450" class="fancybox-iframe" title="Citizen Schools 101">Inline Vimeo Video</a>
I hope this helps someone out!
I had a similar issue. I'm displaying my validation error's into an ordered list above my form rather than displaying them inline. When the jQuery validate plugin finds an error, I set the form to scroll to the top of the form to notify the user of that error(s) by editing the invalidHandler function and disabling the focusInvalid option.
$("#residential-evaluation").validate({
// Scroll to top of #errors on validate
invalidHandler: function(form, validator){
$.scrollTo('#errors', "slow");
},
focusInvalid:false,
//Error output
errorLabelContainer: "#errors",
wrapper: "li"
});
This post was really useful as well:
overriding a function within the jquery validation plugin
This setup relies on the scrollTo plugin for that added animation.
Try using get_post_ancestors. This approach seemed to work for me in a similar situation:
<?php
global $wp_query;
$post = $wp_query->post;
$ancestors = get_post_ancestors($post);
if( empty($post->post_parent) ) {
$parent = $post->ID;
} else {
$parent = end($ancestors);
}
if(wp_list_pages("title_li=&child_of=$parent&echo=0" )) { ?>
<ul id="secondary-nav">
<?php wp_list_pages("title_li=&child_of=$parent&depth=1" ); ?>
</ul><!-- #secondary-nav -->
<?php } ?>
Then I used this to target the current nav states with CSS:
#secondary-nav li a:hover,
#secondary-nav li.current_page_item a,
#secondary-nav li.current_page_ancestor a {
background:#fcb701;
}
You'll probably need to remove the depth parameters to show you're 3rd level pages.
I hope this helps!
You may want to check out Ariel Flesley's jQuery.Listen plugin. It's similar to the live() events and livequery() plugin, but it support's focus() and blur() events.
jQuery load() from within ajaxComplete() callback causing multiple loads
I've been staring at this one for a while and I'm completely stumped. You'll need firebug for this, take a look at the AJAX requests. They seem to be multiplying after each click of next and previous until it's too slow to load entirely:
http://www.ftsdev.com/freegreen/virtual-tour-prototype/virtual-tour.html
All the JavaScript source for this is in:
/freegreen/virtual-tour-prototype/js/virtual-tour.js
Functions to look at:
launchVirtualTour()
$('#vt-next').one('click',function()
$('#vt-prev').one('click',function()
When ajaxComplete() is called I check the file that loaded against an Array outside of the callback function. This allows me to determine whether or not it's the first or last element in the series so that I can hide the Previous or Next buttons accordingly. I have a feeling that the problems lies somewhere in lines 80-82 where I add 1 to the inArray() value stored in indexInArray.
I've searched around but can't find any similar situations out there, any help is much appreciated.
Thanks!
