Stian Lund
Forum Replies Created
-
@littlepackage Thanks for the clarification 🙂
Also, I don’t know what you mean by function in a function?
The code for displaying nav links in the parent theme lives in
wp386_content_nav()function ininc\template-tags.php.I’ve overridden this single function in my child theme in the same place. So it’s more logical/cleaner to add any filters inside there. So I could of course add functions inside *that* function – or in functions.php, but I think it looks a *little* cleaner to do it this way.
Finally, anonymous functions aren’t only more difficult to read but they’re not going to parse any faster than the usual way of doing things.
I was thinking more the other way around, if anonymous functions would be a performance drawback. But no big deal, my site is just for my own fun – no traffic *at all* 😀
- This reply was modified 3 years, 6 months ago by Stian Lund.
- This reply was modified 3 years, 6 months ago by Stian Lund.
@mburridge @littlepackage
Thank you SO much for the tips! 🙂I could swear I tried using add_filter for the next/previous_post_link but couldn’t get it to work, or I didn’t understand that I needed to use
str_replace()with an input argument.I went with the anon function like I did with the other posts type. It’s a bit of a “mess” but saves me adding another function inside a function (this is all in a separate require call from functions.php). But might be bad for performance reasons, what do you think?
// Swap 'rel' attributes for single post next/previous links add_filter( 'previous_post_link', function($format){return str_replace('rel="prev"','rel="next"',$format);}); add_filter( 'next_post_link', function($format){return str_replace('rel="next"','rel="prev"',$format);});Thanks again helpful people! 🙂
EDIT: Oh and the theme I use is this:
https://github.com/keichan34/wp386
It’s getting OLD, not updated by the author for a decade… And will probably stop working at some point. Making small changes to it is just a way to *slowly* learn a little more PHP.I’m adding the code in the overridden
wp386_content_nav()method here:
https://github.com/keichan34/wp386/blob/master/inc/template-tags.php- This reply was modified 3 years, 6 months ago by Stian Lund.
- This reply was modified 3 years, 6 months ago by Stian Lund.
- This reply was modified 3 years, 6 months ago by Stian Lund.
- This reply was modified 3 years, 6 months ago by Stian Lund.
Forum: Plugins
In reply to: [Broken Link Checker] Please update UA string once in a while@wpmudev-support8
Thank you Adam for this great tip, I will consider adding it to WP! 😁Thank you guys for excellent support for this great plugin! 👍
Forum: Plugins
In reply to: [Broken Link Checker] Please update UA string once in a whileHello Patrick,
thanks for the reply.A fresh and updated engine will of course be appreciated – but this is a *single-line* you can try to update at least once a year, and the http checker will continue working for most sites.
You don’t even need to update the whole line to a valid UA, just changing
Chrome/70toChrome/103will do.Chrome 70 was released in 2018 (!)
Best of luck with the new engine!
- This reply was modified 3 years, 9 months ago by Stian Lund.
- This reply was modified 3 years, 9 months ago by Stian Lund.
The problem seems to be that with the following in wp-config:
define('WP_DEBUG', false); //define('WP_DEBUG_LOG', false); //define( 'WP_DEBUG_DISPLAY', false ); //@ini_set( 'display_errors', 0 );I still get the stacktrace, including the password. I need to uncomment the ini_set to show the “pretty” error message without a stack. But sometimes it seems almost random if I get it not.
I suppose things will be OK once the admins get the MySQLi package installed, for some reason they seem to think PHP 7.4 uses the old MySQL drivers…
Thanks for the advice Dion, appreciated.
This was an upgrade from 7.3 -> 7.4. There is no such line in the config, and PHP+WP worked fine before the upgrade. So I think the admins just forgot to install/enable the MySQLi module. It will be fixed I’m sure.
After some investigation I think the issue with the output was the admin had set (or it was default), the PHP value
display_errorsto On for troubleshooting and it affected the entire server and hosted sites while stuff wasn’t working. I’ve now set the value to Off in my.user.iniand maybe that will stop it from happening in the future.My main problem and the topic of this post was rather that when WordPress had a fatal error, it displayed the full credentials to the DB in the output. IMO this is bad practice and such information should be stripped from the output, whether or not WP_DEBUG_DISPLAY is true or false. But not sure where I should report it, maybe as a security issue?
- This reply was modified 4 years, 4 months ago by Stian Lund.
Hello Vijay, thanks for the reply.
Like I said, I *never* enabled WP_DEBUG. But WP still logged debug directly to the web while the database was down.
That’s why I’m asking if there might be some edge case where debug is output even if WP_DEBUG is off.
This is the content of the debug part:
define('WP_DEBUG', false); //define('WP_DEBUG_LOG', false); //define('WP_DEBUG_DISPLAY', false);- This reply was modified 4 years, 4 months ago by Stian Lund.
Forum: Plugins
In reply to: [Broken Link Checker] Please fix sites doing redirects on HEAD requests@bplv Thank you – much appreciated! 🙂
Forum: Plugins
In reply to: [Broken Link Checker] Please fix sites doing redirects on HEAD requestsMy point was that you took the change I made to the Github version and incorporated it into your version without acknowledgement. Not a big deal, but would have been nice…
Forum: Plugins
In reply to: [Broken Link Checker] Please fix sites doing redirects on HEAD requestsHello again Kasia,
I notice the fix I made is now in the plugin. So that’s great, finally. Thank you for that 🙂However I also noticed the Github version has not been updated for ages. So I assume the plugin is no longer available on Github? If it is, where is the active repo?
It would be nice with some acknowledgement in the changelog too 😉
Stian
- This reply was modified 5 years, 11 months ago by Stian Lund.
Forum: Plugins
In reply to: [Broken Link Checker] I couldnt delete a post from my WordPress dashboard@sjon0 Right, thanks for the explanation.
I guess that since we have not heard from @tuham they have solved the issue themselves? Or more likely stopped using the plugin…
Otherwise the solution would be to fix it in “any-post.php”. There are three lines with this, and all occurrences of “_blc_instances” needs to be replaced with only “blc_instances”.
I guess this is just another one of those things that will never be fixed by ManageWP…
However it is changed by Dan’s repo here:
https://github.com/HongPong/broken-link-checker/blob/master/includes/any-post.php- This reply was modified 6 years, 7 months ago by Stian Lund.
Forum: Plugins
In reply to: [Broken Link Checker] I couldnt delete a post from my WordPress dashboard@sjon0 Yes, but the code looks the same for me. Are you saying this happens for all users? I admit I have not tried to delete posts myself, so the problem does not “apply” to me, but it’s strange that the plugin would cause issues for deleting posts from within WP itself.
So I guess the code should look like this instead?
{$wpdb->prefix}blc_instancesForum: Plugins
In reply to: [Broken Link Checker] YouTube links checking issue@cultoftheshadow There is no quick fix I’m afraid, and probably not coming. Apart from maybe getting your own key from Google APIs as outlined here:
https://developers.google.com/youtube/v3/getting-started
https://github.com/ManageWP/broken-link-checker/issues/56You can disable the YouTube API in settings, I assume this is what you’ve done? BLC will then check YT links the same way as regular links, with the drawback that for instance private/hidden videos will still show as OK. This is just how YT works.
Forum: Plugins
In reply to: [Broken Link Checker] False positive with href parameterBroken Link checker looks at your posts’ code, not the resulting HTML output by PHP. So if your posts contain shortcodes for a plugin to parse, you can’t really expect BLC to understand and check these links. Just the way things work I’m afraid.
Forum: Plugins
In reply to: [Broken Link Checker] YouTube links checking issueYou can email me stianlund at Gmail.