WordPress plugin: efficient way to store large data

There’re few plugins to storage it on WordPress database. I recommend you save as users. I believe one of these plugins will help you: https://wordpress.org/plugins/wp-all-import/ https://wordpress.org/plugins/wp-ultimate-csv-importer/ To send emails, you might use an Email Marketing provider, like Mailchimp. In this case you can import all the users to your mailchimp account with this plugin: https://wordpress.org/plugins/mailchimp-sync/ … Read more

Do rewrites added with add_rewrite_rule() persist after plugin deletion?

Let me say beforehand that when using add_rewrite_rule() nothing is written to the htaccess file. Rewrite rules are stored in the database and handled by WordPress internally on PHP level. TL;DR: Rewrite rules do persist after plugin deletion, but probably not the way you’d expect it. When using add_rewrite_rule these rules are added in the … Read more

custom plugin with upload files does not work

Use WordPress defult media uploader and get uploaded link in jquery response it is quit easy <label for=”upload_image”> <input id=”upload_image” type=”text” size=”36″ name=”ad_image” value=”http://” /> <input id=”upload_image_button” class=”button” type=”button” value=”Upload Image” /> <br />Enter a URL or upload an image </label> <?php add_action(‘admin_enqueue_scripts’, ‘my_admin_scripts’); function my_admin_scripts() { if (isset($_GET[‘page’]) && $_GET[‘page’] == ‘my_plugin_page’) { wp_enqueue_media(); … Read more

How to add category and subcategory in WordPress custom code?

The syntax for adding an action in WordPress WITHIN a class is somewhat different. Your code will have to look somewhat more like the following… class MyPluginClass { public function __construct() { add_action( ‘init’, array( $this, ‘sample_insert_category’) ); } public function sample_insert_category() { if(!term_exists(‘sample-category’)) { wp_insert_term( ‘Sample Category’, ‘category’, array( ‘description’ => ‘This is an … Read more

Writing editor content to a file

You should hook save_post instead of publish_post. publish_post only runs when a post is initially published and won’t catch subsequent saves. Additionally, the publish_post hook passes parameters to your function and those should be used to retrieve info about the post being published rather get_the_content(), which only works when you’re inside the loop. I think … Read more