WordPress dbDelta returns a SQL error when updating a table. It returns “Multiple primary key defined“.
I was stuck for two days on this problem. WordPress shown me following error message on plugin activation
The plugin generated 202 characters of unexpected output during activation. If you notice “headers already sent” messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.
WordPress Filter Hooks on Creating Slug – Check Availability of Slug if That is Used by Post, Page, Taxonomy, or by Plugin
I did not find any filter hook for choosing slug for any object. I have a plugin that creates its own URLs. eg. example.com/my-campaign . If someone hits on this url then he will see my plugin generated page. But if there is already a page “My Campaign” then WP is unable to show that page because that permalink already taken by my plugin. So Before creating my plugin slug I need to check ‘WP posts, pages and taxonomies‘ if any of those already used my slug. I also need to check Root directory of WordPress installation if there is a ‘directory with same name‘ of my slug. Continue reading
You may want to publish your WordPress post just right now but post date will be a future time. By default WordPress doesn’t have such option. Here I will show you a very simple trick to do this. Continue reading
When you are creating a WordPress plugin to play with users’ profile meta data, you may need to use some different meta data those are not exists in user profile page. So you must want to have new custom meta field with user profile. Sometimes we call it user custom field. How to do add this custom field? Here I will show you the complete code snippet and a simple demo plugin. Continue reading
WordPress stores your media files like image, video, audio, flash etc in a default location in the wp-content/uploads directory. The default media upload directory is wp-content/uploads/ . But if you don’t want to use this directory, you want to store your media files in another location. WordPress has an option to change this default media uploads location. Its very easy way but if you are very new to WordPress you may think it difficult. So what to do for this? Continue reading
Today I have discovered a strange problem of WordPress / Apache. WordPress / Apache is unable to handle an URL with a query string parameter containing a link of external domain (Cross Domain). It shows not found page. I am trying call a static story.html file from my upload directory. I have to pass some query string with URL of my story.html file. But when I am trying to pass some query parameter in the URL then I am going to a not found page. Continue reading
You may think your website is very new and not much popular. So none can try to hack your WordPress. If you think so then I will tell you are wrong. Form my real experience I know some bad guys are always trying to hack any website. It is a hobby of theme. And some people may hack an website for his benefit. WordPress is an popular and open source CMS. Everybody know the internal codes of an WP site. And it is a nice playground to hacker. Your site is not risk free. Hackers are always trying to hack your site. Continue reading
We can insert any media files in our post content by clicking the button ‘Upload/Insert’ from post editor. But If you need to use files for your WordPress plugin or theme settings, you have to either upload new files form your computer or using files from WordPress media library. You can create a file upload system with your plugin easily that will not well organized. But you can use WordPress media upload library instead. There is no documentation/guide for adding this media uploader functionality in your own settings page. Here I am writing a guide to use this media uploader very easily.