apavlov2
Forum Replies Created
-
Hello,
this didn’t address the root cause of the issue, in fact it didn’t remove the warning at all.
Here’s the full Warning message:
Notice: is_page was called <strong>incorrectly</strong>. Conditional query tags do not work before the query is run. Before then, they always return false. Please see <a href="https://www.ads-software.com/support/article/debugging-in-wordpress/">Debugging in WordPress</a> for more information. (This message was added in version 3.1.0.)
Note that is_page is called inside the is_account_page function.
The issue is caused because is_account_page is called before the template_redirect action is executed, and that’s the issue.Conceptually you should check if template_redirect has been called before using is_account_page, which is defined in the previous step since WooCommerce is a plugin and loads before this plugin. So the function exists, but if somebody calls ‘woocommerce_currency_symbol’ before the $wp_query is initialized, it will throw the warning.
The problem with the code of the function is the following:
global $wp_query; if (!isset($wp_query)) { if (is_order_received_page() || is_account_page()) { if (apply_filters('woocs_currency_symbol_on_order', false)) { return $currency_symbol; } } }
Why is it an issue?
Because when the $wp_query is not set, both ‘is_order_received_page’ and ‘is_account_page’ use the ‘is_page’ core function which is defined in the wp-includes/query.php as this:function is_page( $page = '' ) { global $wp_query; if ( ! isset( $wp_query ) ) { _doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' ); return false; } return $wp_query->is_page( $page ); }
This means that if the $wp_query is not defined when we call is_page, the notice of doing it wrong will be thrown, and both functions will return false, making the code in the nested if statements not execute.
A possible solution would be changing the code to:
global $wp_query; if (!isset($wp_query)) { return $currency_symbol; }
Let me know if this was helpful.
Forum: Plugins
In reply to: [Invoices for WooCommerce] Allow file manipulation after creation.Perfect! Thank you! Looking forward to it!
Forum: Plugins
In reply to: [YITH WooCommerce Wishlist] Killed queries too longHi, I’m getting a similar issue where the query gets killed with the message
KILLED QUERY (18094 characters long generated
SELECT ID FROM i3z4aH5_posts AS p WHERE post_type = 'product' AND post_status = 'publish' AND p.ID NOT IN ( 73, 77, 81, 86, 90, 94, 98, 108, 109, 113, 118, 227, 231, 239, 243, 247, 251, 255, 259, 263, 267, 271, 272, 280, 284, 285, 289, 293, 295, 296, 300, 304, 306, 310, 312, 313, 314, 315, 316, 317, 321, 325, 326, 327, 331, 335, 336, 337, 338, 339, 341, 342, 343, 344, 345, 485, 495, 496, 497, 510, 514, 519, 520, 521, 528, 532, 537, 542, 546, 547, 548, 549, 550, 551, 552, 556, 560, 568, 576, 578, 582, 583, 584, 585, 587, 588, 589, 590, 591, 597, 601, 605, 609, 617, 618, 622, 623, 627, 725, 729, 733, 737, 739, 743, 747, 751, 755, 773, 777, 781, 785, 789, 793, 829, 933, 938, 954, 964, 972, 983, 985, 996, 997, 998, 1000, 1004, 1005, 1007, 1008, 1009, 1010, 1012, 1013, 1014, 1015, 1017, 1019, 1021, 1022, 1023, 1024, 1027, 1028, 1029, 1032, 1034, 1036, 1037, 1038, 1039, 1040, 1041, 1216, 1217, 1218, 1219, 1220, 1223, 1233, 1241, 1245, 1249, 1253, 1257, 1261, 1265, 1269, 1273, 1277, 1289, 1293, 1312, 1319, 1343, 1347, 1351, 1365, 1366, 1371, 1376, 1380, 1385, 1390, 1394, 1398, 1402, 1406, 1411, 1415, 1416, 1417, 1420, 1425, 1449, 1451, 1453, 1463, 1464, 1470, 1504, 1531, 1538, 1546, 1550, 1574, 1628, 1647, 1648, 1653, 1656, 1659, 1662, 1665, 1668, 1671, 1674, 1677, 1681, 1684, 1689, 1692, 1695, 1698, 1701, 1704, 1707, 1713, 1714, 1716, 1720, 1723, 1726, 1729, 1732, 1735, 1738, 1741, 1744, 1747, 1752, 1755, 1758, 1761, 1764, 1767, 1770, 1773, 1776, 1779, 1782, 1785, 1788, 1791, 1795, 1800, 1804, 1807, 1810, 1813, 1818, 1821, 1832, 1836, 1840, 1845, 1848, 1851, 1855, 1859, 1862, 1865, 1869, 1873, 1877, 1881, 1885, 1889, 1893, 1896, 1899, 1902, 1905, 1909, 1913, 1916, 1920, 1924, 1928, 1931, 1935, 1939, 1942, 1946, 1947, 1950, 1953, 1959, 1963, 1968, 1972, 1976, 1980, 1984, 1988, 1991, 1994, 1997, 2001, 2005, 2008, 2011, 2015, 2018, 2022, 2025, 2030, 2033, 2036, 2040, 2043, 2046, 2049, 2052, 2056, 2060, 2064, 2067, 2075, 2080, 2084, 2088, 2091, 2095, 2098, 2101, 2104, 2107, 2110, 2114, 2117, 2120, 2122, 2127, 2132, 2138, 2140, 2144, 2148, 2154, 2159, 2162, 2170, 2173, 2178, 2181, 2182, 2188, 2191, 2195, 2198, 2202, 2203, 2210, 2212, 2217, 2220, 2224, 2228, 2232, 2235, 2238, 2242, 2245, 2248, 2251, 2255, 2256, 2263, 2265, 2273, 2286, 2290, 2292, 2297, 2301, 2320, 2326, 2328, 2333, 2337, 2349, 2359, 2363, 2368, 2369, 2370, 2380, 2384, 2392, 2396, 2403, 2404, 2409, 2424, 2425, 2442, 2450, 2451, 2457, 2463, 2478, 2484, 2489, 2495, 2496, 2497, 2503, 2514, 2521, 2523, 2528, 2534, 2543, 2544, 2554, 2563, 2567, 2573, 2577, 2578, 2582, 2586, 2589, 2590, 2591, 2603, 2612, 2614, 2621, 2622, 2623, 2631, 2642, 2643, 2646, 2654, 2657, 2658, 2668, 2669, 2675, 2679, 2684, 2695, 2699, 2704, 2705, 2712, 2716, 2717, 2727, 2734, 2735, 2740, 2745, 2750, 2751, 2755, 2770, 2771, 2777, 2783, 2789, 2801, 2808, 2819, 2823, 2827, 2830, 2833, 2836, 2839, 2842, 2845, 2846, 2849, 2854, 2858, 2859, 2866, 2867, 2869, 2875, 2879, 2880, 2881, 2883, 2890, 2894, 2896, 2901, 2902, 2910, 2915, 2916, 2922, 2928, 2931, 2932, 2933, 2936, 2940, 2944, 2945, 2951, 2956, 2964, 2965, 2971, 2977, 2981, 2985, 2989, 2993, 2996, 2998, 3006, 3011, 3016, 3017, 3024, 3027, 3030, 3031, 3032, 3033, 3034, 3035, 3036, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, 3046, 3047, 3049, 3050, 3051, 3052, 3053, 3054, 3055, 3056, 3057, 3058, 3059, 3060, 3062, 3063, 3064, 3065, 3067, 3072, 3073, 3074, 3075, 3076, 3077, 3078, 3079, 3080, 3081, 3082, 3083, 3084, 3085, 3187, 3192, 3196, 3200, 3207, 3219, 3220, 3221, 3222, 3223, 3224, 3225, 3226, 3227, 3228, 3229, 3230, 3231, 3232, 3233, 3234, 3235, 3240, 3244, 3249, 3253, 3254, 3255, 3256, 3257, 3258, 3259, 3260, 3261, 3262, 3263, 3266, 3267, 3268, 3269, 3270, 3271, 3344, 3350, 3356, 3423, 3425, 3430, 3435, 3440, 3445, 3450, 3451, 3460, 3471, 3476, 3481, 3492, 3494, 3545, 3550, 3556, 3561, 3566, 3576, 3577, 3582, 3587, 3592, 3597, 3602, 3607, 3612, 3617, 3622, 3628, 3633, 3638, 3643, 3648, 3653, 3658, 3663, 3668, 3673, 3678, 3683, 3688, 3703, 3708, 3719, 3723, 3724, 3733, 3739, 3740, 3745, 3754, 3761, 3762, 3772, 3777, 3781, 3785, 3790, 3799, 3800, 3805, 3806, 3813, 3817, 3825, 3837, 3842, 3847, 3852, 3857, 3867, 3877, 3878, 3889, 3894, 3900, 3906, 3912, 3916, 3920, 3927, 3928, 3932, 3937, 3941, 3945, 3949, 3953, 3965, 3970, 3980, 3985, 4018, 4024, 4029, 4034, 4054, 4066, 4076, 4085, 4091, 4096, 4101, 4106, 4111, 4116, 4122, 4127, 4141, 4151, 4155, 4161, 4166, 4174, 4177, 4182, 4189, 4198, 4200, 4206, 4221, 4230, 4236, 4243, 4251, 4255, 4263, 4265, 4269, 4277, 4283, 4289, 4297, 4303, 4313, 4318, 4324, 4372, 4381, 4402, 4412, 4420, 4445, 4450, 4454, 4463, 4467, 4471, 4503, 4507, 4572, 4576, 4579, 4582, 4586, 4589, 4592, 4725, 4728, 4737, 4740, 4758, 4762, 4763, 4773, 4788, 4789, 4796, 4800, 4803, 4806, 4813, 4817, 4820, 4821, 4828, 4829, 4832, 4838, 4843, 4844, 4847, 4851, 4857, 4861, 4862, 4868, 4872, 4876, 4883, 4884, 4890, 4891, 4897, 4904, 4907, 4908, 4909, 4915, 4916, 4922, 4923, 4934, 4935, 4938, 4939, 4947, 4948, 4951, 4955, 4959, 4963, 4969, 4972, 4975, 4980, 4985, 4988, 4993, 4994, 4998, 5002, 5010, 5014, 5112, 5115, 5118, 5125, 5128, 5132, 5135, 5140, 5143, 5148, 5156, 5162, 5167, 5171, 5175, 5179, 5193, 5201, 5219, 5227, 5322, 5327, 5334, 5340, 5350, 5356, 5361, 5366, 5391, 5395, 5399, 5403, 5413, 5414, 5423, 5428, 5432, 5437, 5441, 5450, 5453, 5457, 5462, 5475, 5476, 5481, 5483, 5487, 5491, 5494, 5497, 5500, 5503, 5506, 5509, 5512, 5516, 5520, 5525, 5526, 5529, 5533, 5536, 5539, 5540, 5547, 5551, 5555, 5556, 5562, 5565, 5568, 5571, 5577, 5580, 5588, 5592, 5596, 5599, 5602, 5606, 5609, 5612, 5615, 5618, 5621, 5629, 5632, 5636, 5641, 5644, 5647, 5651, 5655, 5658, 5662, 5665, 5668, 5673, 5677, 5682, 5683, 5689, 5692, 5695, 5702, 5703, 5708, 5712, 5715, 5718, 5721, 5725, 5729, 5733, 5737, 5741, 5742, 5746, 5752, 5755, 5756, 5765, 5768, 5771, 5782, 5786, 5793, 5797, 5809, 5817, 5825, 5828, 5833, 5837, 5841, 5845, 5854, 5863, 5868, 5876, 5882, 5890, 5895, 5899, 5903, 5908, 5916, 5917, 5922, 5927, 5929, 5932, 5934, 5936, 5941, 5945, 5954, 5960, 5967, 5973, 5978, 5983, 5985, 5990, 5994, 5998, 6008, 6014, 6026, 6036, 6040, 6044, 6049, 6054, 6059, 6065, 6070, 6076, 6081, 6083, 6089, 6092, 6096, 6097, 6101, 6108, 6112, 6119, 6120, 6124, 6134, 6139, 6144, 6149, 6154, 6159, 6169, 6174, 6178, 6180, 6185, 6190, 6192, 6198, 6204, 6209, 6214, 6217, 6219, 6224, 6226, 6236, 6238, 6243, 6248, 6250, 6252, 6259, 6263, 6265, 6276, 6284, 6301, 6302, 6304, 6308, 6312, 6343, 6346, 6350, 6351, 6354, 6365, 6367, 6374, 6381, 6396, 6397, 6398, 6405, 6411, 6424, 6425, 6433, 6452, 6456, 6465, 6472, 6477, 6501, 6503, 6504, 6528, 6535, 6566, 6568, 6572, 6589, 6611, 6613, 6625, 6648, 6649, 6674, 6678, 6680, 6681, 6682, 6683, 6684, 6686, 6693, 6694, 6696, 6698, 6705, 6755, 6760, 6765, 6797, 6823, 6828, 6835, 6843, 6845, 6850, 6858, 6863, 6872, 6905, 6911, 6915, 6919, 6923, 6936, 6940, 6945, 6949, 6954, 6956, 7045, 7049, 7054, 7059, 7063, 7069, 7070, 7095, 7099, 7100, 7101, 7104, 7116, 7117, 7118, 7122, 7126, 7130, 7135, 7140, 7144, 7152, 7158, 7164, 7165, 7173, 7177, 7186, 7202, 7203, 7204, 7205, 7221, 7282, 7286, 7291, 7295, 7299, 7303, 7342, 7344, 7348, 7350, 7351, 7352, 7353, 7354, 7355, 7356, 7359, 7362, 7363, 7368, 7381, 7382, 7383, 7384, 7385, 7388, 7390, 7391, 7392, 7393, 7394, 7395, 7396, 7397, 7425, 7429, 7511, 7512, 7513, 7514, 7516, 7517, 7518, 7548, 7562, 7563, 7565, 7569, 7585, 7586, 7604, 7609, 7613, 7618, 7630, 7632, 7644, 7684, 7828, 7829, 7830, 7833, 7834, 7835, 7837, 7838, 7839, 7840, 7841, 7855, 7856, 7858, 7859, 7861, 7905, 7906, 7910, 7912, 7913, 7914, 7927, 7928, 7929, 7930, 7932, 7933, 7934, 7935, 7937, 7938, 7940, 7941, 7943, 7944, 7945, 7947, 7949, 7950, 7951, 7953, 7954, 7956, 7957, 7958, 7960, 8025, 8026, 8027, 8028, 8029, 8030, 8031, 8032, 8033, 8034, 8035, 8036, 8037, 8038, 8230, 8231, 8232, 8233, 8234, 8236, 8237, 9093, 9094, 9095, 9096, 9097, 9098, 9101, 9102, 9103, 9104, 9105, 9106, 9107
Hi,
I’m experiencing this issue too.
WooCommerce – 3.2.6
PayPal for WooCommerce – 1.4.7.2 (Today’s update)I have enabled ‘Enable guest checkout’ and ‘Force secure checkout’.
I have enabled the Gateway and it works as expected for logged users.Please let me know what further information you need to troubleshoot the issue.