Admin sometimes redirects to HTTPS

Finally, after MONTHS I was able to solve it. Just add $_SERVER[‘REQUEST_SCHEME’] = ‘http’; $_SERVER[‘SERVER_PORT’] = 80; To wp-config.php, preferably before calling wp-settings.php Thanks to Daan Meijer for this. PS: It was a server-side error, probably something to do with PHP process manager such as php-fpm or mod_php. The hosting company solved it without the … Read more

“options.php” not found

Like @LupuAndrei said, we lack of details, especially the code where you call you form from. But I suspect, again like @LupuAndrei said, you might not be calling the settings_fields, do_settings_fields or do_settings_sections correctly. On the function where you build your form, try something like this <form method=”post” action=”options.php”> <table class=”form-table”> <?php settings_fields( ‘animated-settings-group’ ); … Read more

“Add New” button on custom post type grid

As per comments you likely you want to use native editor rather than build one from scratch. From poking through the core source outputting the link for that would be along the lines of: $post_new_file = “post-new.php?post_type=$post_type” if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) ) echo ‘ <a href=”‘ . esc_url( admin_url( $post_new_file … Read more

Is there a better way of handling AJAX requests in WordPress?

Use add_rewrite_rule to make your own API and handle the endpoints yourself. Tools like Monkeyman Rewrite Analyzer will help you understand how your rewrite rules end up working with existing rules. if ( ! class_exists( ‘WPSEAPIEndpoint’ ) ): class WPSEAPIEndpoint { // WordPress hooks public function __construct() { add_filter( ‘query_vars’, array ( $this, ‘add_query_vars’ ), … Read more

How do I edit the WordPress post.php file?

You’ll want to add a custom meta box, and put your code in the corresponding callback. It sounds like you’ve already set up your custom post type, so just make sure you have the last line to register your meta box callback: register_post_type( ‘wpse_cpt’, array( ‘labels’ => array(‘all’,’the’,’labels’), ‘public’ => true, ‘supports’ => array( ‘title’, … Read more

Redirect an entire WordPress site on a subdomain, except wp-admin

Answering my own question for future reference. I couldn’t get a redirect to work with .htaccess, but found some helpful troubleshooting suggestions, mainly this one: https://stackoverflow.com/a/14116956/3218102. I ended up doing this with a modification to header.php and the functions wp_redirect and is_admin. This is the code I added to the top of header.php: <?php // … Read more

Custom widget is not appearing in the admin area

Your code worked for me; The widget appears in the admin area under Appearance > Widgets and the widget does show output on the front end. Your widget() method is missing the output for $args[‘before_widget’]. echo $args[‘before_widget’]; should be added above <section id=”box” class=”box1″>. This would not cause the issue reported, where the widget does … Read more

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