How to change the headline title for an admin page in a plugin?

You shouldn’t need to hook anywhere in particular, simply output your heading at the start of your settings page callback and WP should position admin notices appropriately after your heading (there’s some logic written into the js/jquery). For example i have lines like this at the start of various plugin settings pages. <div class=”wrap”> <h1><?php … Read more

Adding jquery using php function

Why are you not using the built-in enqueue_script function? Simply put your custom jQuery code into a file called custom.js, save it into your plugin or theme folder, then enqueue it with jQuery as a dependency: <?php function custom_scripts() { if (is_admin()){ wp_enqueue_script( ‘customjs’, get_template_directory_uri() . ‘/js/custom.js’, array(‘jquery’) ); } } add_action(‘wp_enqueue_scripts’, ‘custom_scripts’); You’ll need … Read more

List all posts in a particular page [closed]

first, create a custom page template and paste the code <?php // the query $wpb_all_query = new WP_Query(array(‘post_type’=>’post’, ‘post_status’=>’publish’, ‘posts_per_page’=>-1)); ?> <?php if ( $wpb_all_query->have_posts() ) : ?> <ul> <!– the loop –> <?php while ( $wpb_all_query->have_posts() ) : $wpb_all_query->the_post(); ?> <li><a href=”https://wordpress.stackexchange.com/questions/353211/<?php the_permalink(); ?>”><?php the_title(); ?></a></li> <?php endwhile; ?> <!– end of the loop … Read more

Can admin-ajax.php be used for spam purposes? And if yes, how to prevent that?

This is why you use nonces. $.ajax({ type: “POST”, url: ‘/wp-admin/admin-ajax.php’, data: { action: ‘mail_function’, message: ‘test’, _nonce: <?php echo wp_create_nonce( ‘mail_function_’ . $post->ID ) ?>}, dataType: “html”, success: function(data) { } }); Then in your PHP function: function my_ajax_mailer() { if ( ! wp_verify_nonce( $_REQUEST[‘_nonce’], ‘mail_function_’ . $post->ID ) ) return; // send mail… … Read more

Unable to access my plugins [closed]

add this line to your wp-config.php file: define(‘WP_MEMORY_LIMIT’, ’64M’); OR If you have access to your PHP.ini file, change the line in PHP.ini If your line shows 32M try 64M: memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)

wp-admin blank page after admin login and all security off

WP 4.1.1 seems to need a lot more memory than previous versions. Just add define(‘WP_MEMORY_LIMIT’, ‘256M’); in your wp-config.php file just before the /* Stop editing */ comment line and you should get rid of the blank screens. If you can’t access that much memory, go for less, but from my tests the minimum required … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)