Question for self-hosted WordPress users: How do you handle backups och your blog/site?
Question for self-hosted WordPress users: How do you handle backups och your blog/site?
Yesterday I wrote about a problem that I’m having with a WordPress plugin that I’m working on, and I said that I think it’s a bug in WordPress. Here are some more information about it.
The plugin should cross-post/syndicate any new post to Twitter. There are a lot of plugins already that does this, but I wanted a few special features.
So far so good. This all works as intended. There is however one more thing that it’s supposed to do:
The plugin hooks into the publish_post action and early on in its code it checks if ( get_post_format( $ID ) == 'link' )
. If it returns true an XPath query retrieves the href of the first <a> element and uses this instead of the permalink in the Twitter post.
The XPath part works just fine in all my tests.
As long as I post from the WordPress Admin interface, everything works as intended. The problem occurs when I post using the Press This bookmarklet. When I post this way, if ( get_post_format( $ID ) == 'link' )
never returns true
, regardless of the post format.
If I create the post using Press This but instead of publishing I save it as a draft and then publish from the Admin panel, it works as intended.
If so, please let me know.
The code is available on GitHub but I’ve kept the repository private since I’m a little bit embraced by the code, but let me know if you’d like to check it out and I’ll add you to the repo.
WordPress Digest reposted this on twitter.com.
RT: @synvila-Some more information on the WordPress bug that I think that I’ve found #wordpress blog.henrikcarlsson.se/2016/11/some-m… #waptug 41211
Haft besök hela dagen men ska se om jag inte kan bläddra igenom koden. Vill minnas att jag stött på ett liknande problem tidigare.
Fungerar koden via Press This om det är något annat Post Format? Typ image?
Testade samtliga post formats nu och oavsett vilket jag väljer så returnerar get_post_format() en tom sträng via Press This.
Även om du använder dig av $post->ID istället för $ID? Sneglat i core och Post Formats ska fungera med Press This.
Det fungerar så tillvida att inläggen som publiceras får rätt post format. Det är bara det att det inte verkar vara satt i
I’m working on a WordPress plugin to syndicate my posts to Twitter. I know, there are lots of plugins that does that already but none of the ones I’ve found does it the way I want, so I decided to roll my own. I’ve got the basics working and have been using it on my site for quite some time now. However, I’ve encountered a problem. Here’s how I want it to work:
When I publish a link post, instead of posting a link back to my site to Twitter, it should post the link to the site that I’m linking to. The plugin ”knows” whether it’s a link post or not based on
1 2 |
if ( get_post_format( $ID ) == 'link' ) |
At first glance this works fine and it worked in development. However, ones I started using it on my site I realized that it only worked some of the times and other times it wouldn’t recognize a link post.
Tonight I’ve managed to narrow it down. It seems like the problem occurs when I post with the ”Press this” bookmarklet. If I do that, even a post that clearly has been givet the ”link” post format still returns false for if ( get_post_format( $ID ) == 'link' )
. If I post the exact same content using the WordPress dashboard the post is recognized as a link post and everything else works as intended.
Is this a bug in WordPress? I should investigate this further but right now I need to go to bed, so I’m throwing the question out to you, smart people on the internet, instead.
Christofer Vilander reposted this on twitter.com.
Henrik mentioned this on blog.henrikcarlsson.se.
Almost a year ago I wrote about WordPress’ Link Manager. It’s an old feature of WP that seems to get very little use these days. But it is a way to collect links to websites and, this is the important part, their corresponding RSS/Atom feeds, and get an OPML file os the websites in question.
Collected links can be put in categories and every category has its own OPML. You can find the OPML for all my links here.
OPML is one of the file formats that can feed a river in River 5. As far as I know the OPML that River 5 reads needs to be in the lists folder in your River 5 installation, so at first glance that seems to rule out using WordPress’ OPML feature.
The not so secret sauce that makes it work is the ”include” node in OPML. In my lists folder I have and OPML file for each and every river I want River 5 to generate. Each of those files contain a single <outline>
node that links to the corresponding category among my WP links.
For example, my ”Everything feed”:
1 2 3 4 5 6 7 8 9 |
<?xml version="1.0"?> <opml version="2.0"> <head> <title>"Master feed"</title> </head> <body> <outline title="Everything" type="include" url="http://blog.henrikcarlsson.se/wp-links-opml.php" /> </body> </opml> |
This tells River 5 to include everything it finds at the URL http://blog.henrikcarlsson.se/wp-links-opml.php
which, as I just mentioned, is the full list of links that I collect in my sites link manager.
So whenever I want to add or remove a link (site/blog/etc) I just use WordPress’ link manager. That makes it very simple to add and remove stuff and therefore I’m more likely to try to add new sites to the mix and see if they add to my satisfaction or not.
Today I started working on a WordPress plugin (I’ll tell you more about it soon). To do that I needed to brush up a bit on my plugin-writing skills. I’ve always found making WordPress plugins unnecessary frustrating but as I searched for some articles about it today I found this:
Since WordPress 2.8, building widgets has been a matter of extending WordPress’ own widget class, WP_Widget, resulting in your custom widget only having to focus on 4 main functions:
- Initialisation (__construct) – handles actions to take when the widget is first created such as enqueueing specific javascript or stylesheets in the output
- Front-end display (widget) – handles the generation of the widget’s HTML output
- Back-end form (form) – handles the generation of the form controls that make up the widgets edit interface in the Admin interface
- Update (update) – handles the form submission from the back-end form, updating stored data as necessary
I had completely missed this. In my mind plugins was still this boiler-plate filled bag of hurt. Instead all you got to do is subclassing WP_Widget and replacing a couple of methods. Wow!
As I took the approach suggested in the article and based my code on the sample code in it, I got up and running super-quick. A beta version of the plugin is actually running on my local machine already, after maybe an hours worth of work. The fact that it was so easy makes me very happy and gives me the urge to write more plugins.
I think Dave Winer really nails it with this quote and elaboration:1
A.J. Liebling said, famously: ”Freedom of the press is guaranteed only to those who own one.” That’s so true, and with blogging everyone can own their own, and therefore be free. However, we’re trading that in for a bit more engagement.
I will link to this post on twitter so likely most of you who read it will find it there. You’re likely tweeting quite a lot yourself, and that is a good thing. I don’t think you should stop tweeting, and I’m pretty sure Dave doesn’t think that either. I am, however, saying that you should also use your own ”printing press” from time to time.
Use your blog for some of your writing!2 Don’t have a blog? Get one!
I have a lot of bad things to say about WordPress, but if you want an easy-to-setup, easy-to-manage blog you should give it a try. (This site is a WordPress site.) It’s optimal if you self-host it. That way you definitely own every word on it.
Don’t feel like self-hosting? Get an account at WordPress.com. Yes, you are using somebody else’s ”printing press” but at least that somebody is somebody who is dedicated to open publishing and to ensure that you own what you write and that you can write whatever the hell you want.
Afraid that nobody will read what you write if it’s not on Twitter or Facebook or Instagram or [insert whatever]? Write in on your blog and then link to it on your social networks of choice?
You can even use a tool such as Dave’s Radio3 that allows you to make a link blog, or a list of short status updates, and simultaneously publish to Twitter, Facebook, WordPress and an RSS-feed. It’s a great tool that I use for most of my tweeting these days. That way, what I tweet also ends of as link-posts or status-posts here on the blog as well.
There are other options, for both self-hosted and hosted solutions. If you decide to go with a hosted one, the most important thing is to make sure that it has a clear and easy way for you to export everything you write in full fidelity.
Well, maybe I’m exaggerating a bit, but today (or yesterday since it’s passed midnight here) I did what I should have done long before and checked out Markdown. According to its creator John Gruber it’s
a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).
It is both a way to write plain text documents so that their content is somewhat formatted and a tool to convert this text to xhtml.
The reason I checked this out today (or was it yesterday?) was an article in Macworld called Forget fancy formatting: Why plain text is best. It made some good points about why plain text is almost always better than something written in for example Microsoft Word or Apple Pages.
[Plain text is] timeless. My grandchildren will be able to read a text file I create today, long after anybody can remember what the heck a .dotx file is.
The article then mentioned some tools that was great for plain text writing, among them Byword which according to the article ”has baked-in support for Markdown”. I’d heard about Markdown before, mostly from Merlin Mann in the Back To Work podcast so now I finally made myself find out what it was. (Finding out was as easy as clicking the link in the Macworld article.)
The concept behind Markdown seemed really great, so I decided to try it, and to buy Byword. So far I’ve just made some test documents with the Byword/Markdown combination (as well as writing this blog post) and I must say it seems pretty great. I do a whole lot of writing in my work and most of it is just simple text documents that I’ve used to write in Microsoft Word (yes, I actually do like Word) but I guess the bulk of my writing this upcoming semester will be done full-screen in Byword using Markdown and then exporting the appropriate format. (Apart from xhtml, Byword also exports as .doc, .pdf, .rtf and Latex.)
I also found out that although Markdown is written in Perl there is a php version and that version also works as a WordPress plugin. So this very blogpost is written in Byword, marked up (or down?) with Markdown and will then be pasted into a post in my blog, where you will read it.
[…] I started using Markdown (and wrote a blog post about it) I hoped it would help me be more productive and write more for this blog. So far it seems to have […]
I just picked up my secondary computer and logged in on this blog. The first thing I saw was WordPress telling me that I use an old browser. Since Safari 5.1 is out, apparently 5.0.5 is considered old. This is a fairly aggressive mode (I prefer to see things like IE6/7/8 and Firefox 3 as old) but I love it.
Good work WordPress! Anything that make people update their browsers more often is great.
I’ve just enabled WP Super Cache on this blog. This is the first time I use a static cache on a WordPress blog. Hopefully it will speed things up and make it more fail safe.
I somras bytte jag webbhotell, från dåliga Scorpion Data till bra Binero. Det gjorde mitt liv lättare på alla sätt och vis, bortsett från en detalj. Helt plötsligt slutade autouppdateringen av WordPress att fungera för mig.
När WordPress släpps i en ny version så talar alla WordPress-bloggars kontrollpanel om detta för sina administratörer och frågar om en uppdatering ska göras. Det finns två sätt att göra detta på. Antingen genom att ladda ner WP och sedan ersätta den befintliga installationen på din webbserver. Detta är en inte helt självklar process eftersom du måste se till att inte råka radera filer du vill behålla (teman, uppladdad media etc).
Den enklare lösningen är att låta WordPress autouppdatera sig själv vilket har fungerat ypperligt, tills jag bytte till Binero. Jag har provat att söka efter en lösning i deras WIKI och FAQ men utan att lyckas. Dock hade jag fram tills idag inte brytt mig om att maila eller twittra till deras support.
Idag frågade Johan på Twitter om någon annan hade problem med att uppdatera till WordPress 3.0.4. Eftersom jag vet att Johan också använder Binero så passade jag på att vidarebefordra frågan till @binero, kontot på twitter som de använder för support. Vi fick mycket snabbt ett svar som löste Johans problem. Jag antar att det även kommer lösa problemet för mig.
Om du har samma problem så kan du läsa lösningen här. I korthet så går det ut på att lägga in följande kod någonstans i din wp-config.php-fil.
define( 'FS_METHOD', 'direct' );
define( 'FS_CHMOD_DIR', 0755 );
define( 'FS_CHMOD_FILE', 0644 );
[…] This post was mentioned on Twitter by Binero, Carl Fredriksson and others. Carl Fredriksson said: Denna tackar vi för. RT @synvila_rss: Bloggen: Problem med autouppdatering av WordPress hos @Binero? http://bit.ly/hrINkO […]
Replies and comments
jemostrom
21 juli, 2020 13:12@MrHenko inte alls 😜 Jag har inget jag inte skulle kunna göra om plus att jag litar på att Websupport har en fungerande backup. Använde JetPack tjänsten några år men ville bort från WordPress
jeremycherfas
21 juli, 2020 14:11@MrHenko Plugins. I think the one I use is WP-Backup.
jamesvandyne
21 juli, 2020 21:54@MrHenko I’m using the daily snapshots of the server (Digital Ocean) as my backup method.
jamesvandyne
23 juli, 2020 12:25@MrHenko Ah. I doubled checked and it’s an automatic weekly backup. It only costs a dollar / month + storage costs. To setup there’s just a checkbox to enable backups and it’s set it and forget it.
They’ve also got a a guide how to automate it more frequently up at How To Use DigitalOcean Snapshots to Automatically Backup your Droplets.
jeremycherfas
23 juli, 2020 15:39@MrHenko The one I use is at github.com/matzko/wp… I notice that is has not been tested with the latest version, but it is still working for me.
jemostrom
23 juli, 2020 21:35@MrHenko korrekt, det är gamla binero.
Jag gillar idén bakom WP och jag har väl nån sorts hatkärlek till programmet. Det som jag tycker är dåligt är
känns inte ”elegant”
är rätt långsamt
buggfixarna verkar inte ta slut
har tappat data många gånger
det som man skickar in i WP är väldigt bökigt att få ut i ett vettigt format (informationen är delvis inlåst)
enskilda personer som jag är inte målgruppen för utvecklingen
jag ogillar den riktning som WP tycks vara på väg mot
WP är rätt värdelös på att hantera foton
idén att lagra inlägg som HTML är enligt min åsikt idiotiskt, speciellt när det gäller länkar till andra inlägg, foton, etc
Det är vad jag kom på just nu. Sedan finns det folk som är jättenöjda med WP och det är ju bra för dem, jag tycker också det bra att det är enkelt & gratis för alla att ska en sajt men jag har personligen lite problem med hela systemet
jemostrom
26 juli, 2020 08:40@MrHenko 😝 jag flydde från loopia till Binero för 11-12 år sedan … och nu har Loopia köpt Binero 😋
Jodå, jag har väl börjat bygga ett system 10 gånger eller så, velat mellan system som Pelican, Drupal (det första systemet som jag använde), Hugo, Blot, osv. Just nu är det en Hugo sajt som jag håller på att bygga. WP är trevligt men ändå inte.
jemostrom
26 juli, 2020 08:42@MrHenko vilken firma använder du
jemostrom
30 juli, 2020 08:51@MrHenko har funderat på Linode många gånger men eftersom släkten har sin email på mina domäner så blir det för dyrt att ha två tjänster