How to count number of records found in a database table?

Why don’t you directly echo the $num as it will contain the count of rows already…Here’s the edited part.. //To show number of rows in table function DB_Tables_Rows() { global $wpdb; $table_name = $wpdb->prefix . ‘mydata’; $count_query = “select count(*) from $table_name”; $num = $wpdb->get_var($count_query); echo $num . ‘Rows Found’; }

How many security plugins are too many? [closed]

This isn’t a question of quantity. You have to understand what each plugin does to say whether it is necessary or not. Let’s say we have three “security” plugins: One enforces strong passwords. One blocks aggressive log-in attempts. One sends you an email when your PHP version is behind the latest security release. Having these … Read more

wp_mail() is not working in localhost

wp_mail() falls back to php’s mail() function which requires a configured MTA (Message Transfer Agent) on your host. So either you install and configure such a MTA. If you’re running a Linux like OS, SSMTP is an easy solution on which you can use any mail-provider to send your system mails via SMTP. Another MTA … Read more

Why is my ajax call refreshing the page?

Try using preventDefault(), it’s a jQuery function for preventing default actions called by the browser. First you should call an event handler by firing up your submitter. You can do this as follow: $(‘#my_upload_form’).submit(function (event) { After catching a submit and giving an event with it, you should prevent the default refresh of a browser: … Read more

WordPress shortcodes & performance

You need to look at this from a couple of perspectives and then you have to weigh the odds against each other In general, shortcodes will be slower (we are talking milliseconds here) as they need to be parsed and processed by the shortcode handler. USAGE: [my_shortcode] in post editor Shortcodes in general are quite … Read more

Does Quantity of files in a plugin affect performance?

You’re worrying too much about something that doesn’t mean much. WordPress doesn’t care how many PHP files you have; the PHP interpreter does. And the PHP interpreter really doesn’t care about the number of files until it actually accesses those files and executes the code. And for all purposes, the interpreter doesn’t access a file … Read more

Exclude custom post_type in sitemap generation?

If you are using functions.php script to register custom post type, you should declare false to ‘has_archive’ => true,. function custom_post_type() { $labels = array( … ); $args = array( // you have to set it to False. ‘has_archive’ => false, ); register_post_type( ‘post_type’, $args ); } add_action( ‘init’, ‘custom_post_type’, 0 );

I need to Remove this line

This happens when you check that sneaky checkbox while installing WordPress: Discourage search engines from indexing this site To disable it, simply head over to Settings > Reading and disable the above checkbox. If this is being added to your theme’s header by a third party plugin, then it’s not easy to answer.