WordPress’te sözdizimi hatasını nasıl düzelteceğinizi merak ediyor musunuz?
Web sitenize kod parçacıkları eklemenizi gerektiren pek çok WordPress öğreticisi var. Ne yazık ki, küçük bir hata tüm sitenin çökmesine neden olabilir, bu da özellikle yeni kullanıcılar için çok korkutucudur. WordPress sitenizde yeni bir şey deniyorsanız ve aşağıdaki hatayı aldıysanız “Sözdizimi hatası, beklenmedik…”, o zaman panik yapmayın.
Bu makalede, WordPress’te beklenmedik sözdizimi hatasını nasıl düzelteceğinizi göstereceğiz.
Hataları Önlemek için Doğru Sözdizimini Kullanma
Yapmanız gereken ilk şey, web’den WordPress’e kod parçacıkları yapıştırmak için yeni başlayanlar kılavuzuna bakmaktır. Bu makale, WordPress şablonlarına kod yapıştırırken yeni başlayanlar tarafından yapılan bazı çok yaygın hataları listeler.
Sözdizimi hatası genellikle kod sözdiziminizdeki küçük ama önemli bir hatadan kaynaklanır.
Örneğin, eksik bir virgül veya tüm komut dosyasını bozabilecek fazladan bir küme parantezi olabilir.
Yakın zamanda web’den bir parçacık mı yapıştırdınız? Bir eklentiyi mi güncellediniz? O zaman büyük ihtimalle nereye bakacağınızı biliyorsunuzdur.
Video Eğitimi
Videoyu beğenmediyseniz veya daha fazla talimata ihtiyacınız varsa, okumaya devam edin.
FTP Kullanarak Sözdizimi Hatasını Düzeltme
Sözdizimi hatasını düzeltmek için, bu hataya neden olan kodu düzenlemeniz gerekir. Kodu kaldırabilir ya da sözdizimini düzeltebilirsiniz.
Genellikle yeni başlayanlar paniğe kapılır çünkü bu hata tüm sitenizin erişilemez hale gelmesine neden olur. Kodu WordPress panonuzun Görünüm ” Düzenleyici bölümünü kullanarak yapıştırdıysanız, dışarıda kaldınız demektir. WordPress yöneticisinin dışında kaldıysanız ne yapmanız gerektiğine ilişkin kılavuzumuza göz atın.
Peki kodu nasıl düzenliyorsunuz?
Bunu düzeltmenin tek yolu, en son düzenlediğiniz dosyaya FTP kullanarak erişmektir. Adım adım talimatlar için FTP’nin nasıl kullanılacağına ilişkin kılavuzumuzu okuyun.
FTP programını kurduktan sonra, web sitenize bağlayın ve düzenlenmesi gereken tema dosyasına gidin. Hangi dosyayı düzenlemeniz gerektiğini unuttuysanız, hata koduna bakmanız yeterlidir. Hata size tam olarak hangi dosyayı ve hangi satırı düzenlemeniz gerektiğini söyleyecektir.
Son eklediğiniz kodu kaldırabilir ya da kodu doğru sözdiziminde yazabilirsiniz. Kodu kaldırmayı veya düzenlemeyi tamamladıktan sonra dosyayı kaydedin ve sunucunuza geri yükleyin.
Bundan sonra, WordPress sitenizi ziyaret edin, sayfayı yenileyin ve sitenizin tekrar çalıştığını göreceksiniz.
WordPress’te Sözdizimi Hatası Nasıl Önlenir?
WordPress web sitenizin tekrar kırılmasını önlemek için, her zaman WPCode gibi bir kod parçacıkları eklentisi ile özel kod eklemenizi öneririz.
WPCode, temanızın functions.php dosyasını düzenlemek zorunda kalmadan WordPress’e kod parçacıkları eklemeyi kolaylaştırır.
Ayrıca, yaygın kod hatalarını önlemenize yardımcı olmak için akıllı kod parçacığı doğrulaması ile birlikte gelir.
Özel kodunuzu eklerken, WPCode tüm hataları otomatik olarak algılar. Hatanın üzerine geldiğinizde, hatanızı kolayca düzeltebilmeniz için yardımcı talimatlar görüntülenir.
WPCode ayrıca bir sözdizimi hatası algıladığında özel kodunuzu hemen devre dışı bırakacaktır.
Artık kod parçacıkları eklerken sitenizi bozma konusunda endişelenmenize gerek yok.
WordPress’e kolayca özel kod ekleme hakkındaki kılavuzumuzda daha fazla bilgi edinebilirsiniz.
Umarız bu makale WordPress’teki sözdizimi hatasını düzeltmenize yardımcı olmuştur. WordPress hızını artırmaya yönelik nihai kılavuzumuzu ve Mac ve Windows için en iyi kod düzenleyicileri uzman seçimimizi de görmek isteyebilirsiniz.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Syed Balkhi says
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
Roberta says
This is a frustrating error and your tutorial allowed me to fix it in less than 5 minutes. Thank you so much!
Jamie den Haan says
Hi,
Can someone please help me out? I keep getting a ‘SyntaxError: JSON Parse error: Unexpected identifier ”Error” when i want to check out on my website. I don’t know what to do and nobody can place an order!!
Thanks a lot,
Jamie
Aaron says
I get “critical error: could not connect to server” when I enter my server information. So I can’t even get to the point that your video begins at.
WPBeginner Support says
Hi Aaron,
You can also connect to your server using File Manager app in your hosting account dashboard.
Yönetici
Daryl says
You’re amazing. Thank you for these videos.
Raffy says
Thank you SO SO much! The bad snippet was invisible inside the Admin page in WordPress, for some reason, but fully visible in the functions.php found in the FTP!!
You saved my day, thank you very much again!
Kim martin says
Thank you SO much! 7 days of getting My hosting service(a very large popular one) to try to fix this no luck just trying to upsell me on things I neither want nor need.
Me thinking okay a whole new website and i found this, I just actually deleted the whole plugin(elementor) Whoo Hoo!
Micah says
Hello:
I have run into this error helping someone else out with their website, so I wasn’t using my actual website when I got this error. I’m wondering how I can remove the error when I’m working on someone else’s site? I have their wordpress. org login information, but obviously I’m locked out of everything now. Any guidance would be appreciated.
Tamia says
Thanks for this tutorial. I had a parsing/syntax problem when editing functions.php in a new website. I was working on the admin page of my WordPress site when I attempted to comment-out a line of code (using instructions by the theme author) but that caused the error. I had copied the functions.php code to TextWrangler, made the alteration, and pasted the whole doc back into the edit window. In “updating” the page I got the error and was effectively locked out of the site. So I used FTP to upload and overwrite the relevant doc, using a backup I’d made the previous day (thank goodness for those). If it hadn’t been for WP Beginner’s clear instructions here and on the “What To Do When You Are Locked Out of WordPress Admin (wp-admin)” post, I’d have been tearing my hair out. Thanks!
WPBeginner Support says
Hi Tamia,
We are glad you found WPBeginner article helpful
Don’t forget to follow us on Facebook for more WordPress tips and tutorials.
Yönetici
stanley says
Thanks for saving my website from errors
Tom Delano says
In trying to log into my page via Filezilla, am I supposed to use my admin account or my WordPress account? I’ve tried both and the password authentication keeps failing. I have my original admin password and it’s worked consistently since I’ve had the website up.
WPBeginner Support says
Hey Tom,
You’ll need to use your FTP username and password. You will find it in the email you received from your web hosting company when you first signed up. You can also find this information under your cPanel dashboard.
Yönetici
chris says
thank you so much! you saved me
Justine says
I urgently need help. CO-editor on my site (which is supposed to launch tomorrow) tried to change code to change our profile pictures. Something went horribly wrong and we locked out of our site. Get this error: Parse error: syntax error, unexpected ‘add_filter’ (T_STRING) in
Giacomo Lawrance says
Thank you so much! You really saved me there. So grateful of this awesome site, thanks again!
Sara says
You saved my life!
Thank you so much!
Monica says
Re: my last comment, I deactivated the plugin and the error went away. So you won’t see what I was describing anymore. I just decided to not use it than try to spend all night figuring out the problem.
Monica says
I am getting parse error syntax errors on all my product pages. This was brought to my attention by someone trying to shop my site. I have not made any edits to the code, installed any new plugins, or accessed the site at all in months. Not sure when this started but I haven’t had an order in few weeks. If I didn’t add or edit anything to cause this how do I know what to fix? All the error messages reference line 1 of the php file but all there is on line 1 is <?php. It's on all product pages. Here is just one example:
shazwan says
Hi,
I’m managing a website for my society and its has been long since the last time everyone actually had logged into the hosting account and we kind of lost the log in credentials and didn’t even know what hosting we’re using because they paid years ahead before. And maybe changed providers. But I know that our domain is from Godaddy and checked, but the hosting isn’t from the same provider.
It may take some time as we dig through the emails, is there any way to fix syntax error other than through FTP?
WPBeginner Support says
Hi shazwan,
Unfortunately there is no way around it. There are online tools that will help you figure out where you website is hosted.
Yönetici
Patrick says
Hi. I tried uploading a theme though Filezila since WordPress was having issues trying to upload the theme and now I’m locked up and I get these two lines
Please Help!!! Thank you!
WPBeginner Support says
Hi Patrick,
Seems like upload was interrupted. Please try uploading the theme files again.
Yönetici