Tag Info

Hot answers tagged

5

This is a bug (one that I've encountered before) and could do with a ticket in trac (since I never took the time to submit one!) The trouble starts with requests that set multiple is_* query flags as true (specifically flags that represent objects, such as single posts, pages, and post type & term archives). This is because there can only ever be one ...


4

There is no such action in the front end (in a theme) by default. Simply use a custom action like do_action( 'theme_notices' ); and hook into this one.


4

I don’t know how to move the notices to the bottom or if that’s possible at all. To disable the debug mode in wp-admin write in wp-config.php: define( 'WP_DEBUG', FALSE === strpos( $_SERVER['REQUEST_URI'], '/wp-admin/' ) ); Untested: You could try to enable warnings in admin with: // happens early in wp-admin/admin.php add_filter( ...


4

get_the_ID() is broken. function get_the_ID() { return get_post()->ID; } It tries to use the member ID on a function that returns a post object sometimes: /* * @return WP_Post|null WP_Post on success or null on failure */ function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) { get_posts() can return NULL, and NULL has no ...


3

The problem was that I had this code in one of my theme admin pages: if (isset($_GET['download'])) check_admin_referer('mytheme_options_storage'); which got triggered by the export request since that also sets $_GET['download'] var. The solution I came up with was to make sure my check only ran when the relevant page was requested, and also I ...


2

Try this. I cleaned up your arg array and placed everything in a function. Also, why are you using the getInstance method when your efpd_admin_notice is public? See the code below for accessing this method properly. function plugin_update(){ $plugin_update = Efpdd::efpd_admin_notice(array( 'type' => 'update', 'message' => 'The ...


2

The basic idea for debug here is that theme apparently influences something it totally should not. Either something is done in a wrong way or in a wrong place. Check that theme is not running any functionality directly in functions.php. Check that all of theme's functionality runs on appropriate hooks. For hooks that are used both on front-end and back-end ...


2

There is an action, 'core_upgrade_preamble', which can be added to output anything you would like at the bottom of the upgrade-core page. For example, try: add_action('core_upgrade_preamble', 'add_custom_upgrade_core_message'); function add_custom_upgrade_core_message(){ echo "<p>HI THERE</p>"; } That should work to meet your needs.


2

You could filter the_content: add_action( 'post_updated', 'wpse105892_add_message', 10 ); function wpse105892_add_message() { add_filter( 'the_content', 'wpse105892_display_message' ); } function wpse105892_display_message( $content ) { // remove the action once it's run remove_action( 'post_updated', 'wpse105892_add_message', 11 ); ...


1

The short answer is no, it is not possible. When you deactivate your plugin, it's deactivated so doesn't run your admin_notices action when the admin screen is refreshed. You can confirm it for yourself by using the action in a slightly different way. In your deactivation function include the following line: set_transient('my_deactivation_transient', 'My ...


1

The quick and dirty way to do it is to create a file named .maintenance at the root of the site-- same directory as license.txt-- and add a bit of PHP: <?php die(); Of course, you can create whatever markup and messages you'd like before the die();, but there is very little WordPress available since it fires very early in the wp-settings.php file. If ...


1

this string is displayed when you get a nonce mismatch, something that should not happen much under normal usage. If it does haen enough to make you aware to it then you should investigate the cause. Anyway, no easy filter for that string so you will have to use the translation api to replace it. add_filter ( 'gettext', 'wpse_120304', 10, 3 ); function ...


1

The issue is in using the $post variable for arguments. After changing this to something like $new_post I no longer get the notices. There must be some conflict with the global $post that WordPress uses. I took this from the Codex, but looking back at the page, I realize that $post was just referring the argument name and the actual example in the codex ...


1

Try to disable/suppress all error warnings/notices in your wp-config.php (on top). Anyway: Errors are nothing bad. They give you a chance to fix your code.


1

WP_DEBUG has no impact on PHP error output. In addition to error_reporting setting, set display_errors=0 in your php.ini file. It's enabled by default for development. But you'll want it off on production servers.


1

Here is what I did. In my taxonomy archive template I was relying on is_post_type_archive() to output additional div tags. add_action( 'parse_query', 'orb_parse_query' ); function orb_parse_query( $wp_query ) { global $post_type_obj; if ( $wp_query->is_post_type_archive && $wp_query->is_tax ) { $post_type_obj = ...


1

You could use /wp-admin/admin-post.php. Link: $url = admin_url( 'admin-post.php?action=somethingunique' ); print "<a href='$url'>Update and redirect</a>"; Then you should register a callback for that action: add_action( 'admin_post_somethingunique', 'wpse_85825_callback' ); And in that callback you can do what you want: function ...


1

Given that the page works if you leave the original query alone, your solution is pretty simple. Leave the original query alone. You don't need to overwrite that query in order to created secondary loops. Instead of this: query_single('dealers', 'publish', '1', $taxtype, $value); if (have_posts()) : while (have_posts()) : the_post(); You ...


1

This would be an good use PHP 5.3+ anonymous functions. Closure example: <?php function Twit_the_url( $post_ID ) { //connect to twitter api //send tweet with url //get twitter response //send response to admin notice : add_action('admin_notices', function() use ($httpstatus) { echo '<div class="error"><p>', ...



Only top voted, non community-wiki answers of a minimum length are eligible