saving variables after redirect

You could store the password as a transient, then pass the transient key in the URL instead so it can be retrieved using that key on the next page. function process_my_form() { if ( ! empty($_POST[‘password’]) ) { $password = ($_POST[‘password’]); } else {return;} /* Store Password via Transient API */ $passkey = wp_generate_password(12, false); … Read more

Preventing Duplicating Posts from Widgets

You should use post__not_in parameter (see Post & Page Parameters in Codex). Since it takes an array you will also need to switch to array rather than string for passing arguments. Something like this: query_posts(array( ‘showposts’ => 1, ‘cat’ => get_catId( $instance[‘catOption4’] ), ‘post__not_in’ => $themename_do_not_duplicate, ));

SFTP define in wp-config.php

Do you mean SFTP or FTPS? For SFTP you need to enable libssh2-php on your server and link it to your PHP and restart your ssh, you can get the downloads here http://www.libssh2.org/ Once you install that you should automatically see SFTP/SSH option in your admin under “Connection”, though I believe there was some recent … Read more

Help me edit a variable with php

How about defining a custom page template? If you put /* Template Name: Two Column */ as the first line of your PHP and put the template with the other templates (page.php, home.php, index.php, etc) in your theme, then on the page creation screen there will be an option to select template which you can … Read more

How to access a variable on all page?

Generally, you cannot access local variables in a function from outside the function, so this… function func() { $var = 2; } $var = 1; func(); echo $var; would result in “1”. To make a global variable, you can do this to make $option available outside functions.php: function func() { global $option; $option = get_option( … Read more

No access to global variables?

To answer your question directly, yes, $wpdb is “auto loaded and set up to global by WordPress” but by loading wp-content/themes/roots/script.php directly you are skipping over the WordPress boot process and loading the file exactly as if WordPress did not exist. That is why the normal WordPress objects and constants aren’t available. They haven’t been … Read more

Cron Job variable not accessible

First of all, it’s best not to include wp-blog-header.php. Instead, set the cron job to your homepage URL with a ?mycustomcron=true variable appended (eg: http://example.com/?mycustomcron=true. Then we will check for the existance of this variable when the page loads: function wpse_103127_check_cron() { if ( isset( $_GET[‘mycustomcron’] ) ) { // things to do on cron … Read more

Trying to create an edit page link?

What you want is the get_edit_post_link function. Usage: echo ‘<a href=”‘.get_edit_post_link( $post_id ).'”>edit</a>’; Your use of global $post and the other issue is a separate problem, you should ask a new question and provide more details ( including the code for the template being used )

Pushing Category and Publish Date to Google Analytics

If you’re printing your script inline (i.e. not in an external file), you can use PHP to dynamically output the JavaScript argument: <script> _gaq.push( ‘setCustomVar’, 3, ‘pubDate’, ‘<?php the_time( ‘Ym’ ) ?>’, 3 ); </script> See the PHP manual for date arguments, which will explain why I’ve used Ym.

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