Headers already sent error with get_template_part in REST API call

Crosspost from StackOverflow

I’ve looked at multiple other questions about this warning (Headers already sent…etc) and this thorough explanation, but I’m not finding a solution for the circumstances I’m dealing with:

  1. I have a custom WordPress REST API endpoint that returns the output of get_template_part. When I just call get_template_part normally on a page, there’s no warning. It only appears when it runs in register_rest_route‘s callback.
  2. I am also fetching data from an external API using this library. The error started when I started making these requests. I’ve tried making the request both inside and outside the template part, the latter either within register_rest_route‘s callback or as an init action.
  3. The line that triggers the error is an img tag, where I’m echo-ing a URL as the src using data from the external API response. There are other echo calls all over this template, so I doubt that’s the issue.
  4. The line in question actually works fine and does its job. I just need to get rid of the accursed warning.


Inside functions.php:

<?php    //the api endpoint declaration   add_action( 'rest_api_init', function () {     register_rest_route(         'theme/v2',   // namespace         '/homepage',  // route         array(                  // options             'methods'  => 'GET',             'callback' => 'build_home',         )     );   });    //the callback for the wordpress api   function build_home() {      // this is the external API request, using their PHP library.      // I linked the library above. The request returns an object with a bunch of data     include_once(get_template_directory()."/arena/arena.php");     $  arena = new Arena();     $  page = $  arena->set_page();      $  per = 8;      $  slug = 'concepts-bo-6ajlvpqg';      $  channel = $  arena->get_channel($  slug, array('page' => $  page, 'per' => $  per));      //I'm passing the response from the external API (in $  channel) to get_template part     //get_template_part is then the output for the wordpress API request     get_template_part('custom-home-template',null,array('channel'=>$  channel));  }   ?> 

Inside template part:

<?php   $  channel=$  args["channel"];   ?>    <div id="concepts-box" class="bodycontent reg-width">     <?php foreach ($  channel->contents as $  item) { if($  item->class=="Image"){       $  img=$  item->image["square"]["url"];       ?>     <div class="concept-wrapper">       <!-- the line below is the one that triggers the error -->       <img lozad src="<?=$  img; ?>">     </div>     <?php }} ?>   </div> 

Full warning:

<b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /filepath/wp-content/themes/theme/custom-home-template.php:63) in <b>/filepath/wp-includes/rest-api/class-wp-rest-server.php</b> on line <b>1372</b><br /> 

I getting error when deploying the TableForm

vlabs = {0 -> "0", 1 -> "1", 2 -> "2"}; TableForm[{{"Java", RadioButtonBar[Dynamic[t1], vlabs]}, {"Pyhton",  RadioButtonBar[Dynamic[t2], vlabs]}, {"CSS",   RadioButtonBar[Dynamic[t3], vlabs]},   Button["Save",   DatabinAdd[   Databin["----"], {{"seher", {"java", t1}, {"pyhton", t2}, {"CSS",t3}}}]]}] 

When I run this code on the Worksheet It’s saving my datas to the databin. When I run this on the Worksheet It's saving my datas to the databin.

But however when I deploy it with CloudDeploy function and click the save button I see this page: enter image description here

What can be the problem? Can you help?

Why mathematica is returning error when computing correlation under Compile?

Can someone tell me what am I doing wrong here ..

corr = Compile[{{array1, _Real, 1}, {array2, _Real, 1}},    Block[{corr}, corr = Correlation[array1, array2]; corr],CompilationTarget :> "C"] lm = Compile[{{array1, _Real, 1}, {array2, _Real, 1}},    Block[{mdlfit, x},  mdlfit = LinearModelFit[Join[Transpose[{array1}], Transpose[{array2}], 2], x, x];  {mdlfit, Sqrt[mdlfit["RSquared"]]}],CompilationTarget :> "C"] array1 = N[{2, 4, 5, 6, 3, 7, 5, 8, 9, 6, 4, 7, 6, 5}]; array2 = N[{5, 7, 8, 6, 3, 1, 2, 4, 5, 8, 7, 2, 3, 4}]; corr[array1, array2] // AbsoluteTiming lm[array1, array2] // AbsoluteTiming  


CompiledFunction::cfte: Compiled expression -0.218004439363 should be a rank 1 tensor of machine-size real numbers. >>  CompiledFunction::cfexe: Could not complete external evaluation; proceeding with uncompiled evaluation. >>  {0.049968, -0.218004439363}  {0.001135, {FittedModel[6.09022556391 -0.263157894737 x], 0.218004439363}}  

why computation of Correlation is giving error while LinearModelFit is working? If I get rid of ‘CompilationTarget’ from LinearModelFit then it’s also giving error

CompiledFunction::cfex: Could not complete external evaluation at instruction 6; proceeding with uncompiled evaluation. >>  ``` 

Google Search Console reports error for ‘noindex’ tag on sitemap

My sitemap is dynamically generated by Yoast SEO WordPress plugin, and is returned with noindex. I submitted the sitemap URL to Google Search Console, but it reports an error:

Submitted URL marked ‘noindex’

I checked with Yoast & other sitemap generators–they all mark sitemaps as noindex by design, to prevent them from appearing in Google search results. It logically makes sense, but then why is Google Search Console reporting it as an error? How do I reconcile this?

ERROR 1064 (42000): You have an error in your SQL syntax – Cannot understand what the error means

I’m trying to import an SQL db, exported from another place. I have the SQL create script. I am not sure what might be going wrong…

My mariadb version is

select version(); +----------------+ | version()      | +----------------+ | 10.5.8-MariaDB | +----------------+ 1 row in set (0.000 sec) 

Table create script:

-- phpMyAdmin SQL Dump -- version 5.0.4 -- https://www.phpmyadmin.net/ -- -- Host: db -- Generation Time: Jan 04, 2021 at 05:59 PM -- Server version: 8.0.22 -- PHP Version: 7.4.11  SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; SET time_zone = "+00:00";   /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */;  -- -- Database: `mytestdb` -- CREATE DATABASE IF NOT EXISTS `mytestdb` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; USE `mytestdb`;  -- --------------------------------------------------------  -- -- Table structure for table `categories` --  DROP TABLE IF EXISTS `categories`; CREATE TABLE `categories` (   `id` int NOT NULL,   `category` varchar(100) GENERATED ALWAYS AS (json_unquote(json_extract(`json`,_utf8mb4'$  .category'))) VIRTUAL NOT NULL,   `popular` enum('true','false') GENERATED ALWAYS AS (json_unquote(json_extract(`json`,_utf8mb4'$  .popular'))) VIRTUAL NOT NULL,   `imageUrl` varchar(255) GENERATED ALWAYS AS (json_unquote(json_extract(`json`,_utf8mb4'$  .imageUrl'))) VIRTUAL NOT NULL,   `json` json NOT NULL,   `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci; 


ERROR 1064 (42000) at line 33: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NOT NULL,   `popular` enum('true','false') GENERATED ALWAYS AS (json_unquote(...' at line 3 

Authorization error running db2 command line with db2inst1

I need to enable the COLUMNAR setting in DB2 Express Edition on Docker. For that to work I need to set INTRA_PARALLEL ON at the instance or database level.

I connect to the db2 command with db2inst1 that is the instance owner, but I’m getting an error saying that the user is root. How to fix this problem?

db2 => connect to bank0002 user db2inst1 using xxxxx     Database Connection Information   Database server        = DB2/LINUXX8664  SQL authorization ID   = DB2INST1  Local database alias   = BANK0002  db2 => UPDATE DBM CFG  USING INTRA_PARALLEL ON SQL5001N  "ROOT" does not have the authority to change the database manager  configuration file. 

Database error: You have an error in your SQL syntax term_taxonomy

It’s been a while since this syntax error has been happening, I tried to look it up, have read articles and forum’s posts on this issue, but I still couldn’t fix it. It says I have an error on my database, but I’m afraid it might be my server. This mysql error is happening when I edit articles. I wished I could explain this better, but I have no idea of what’s going, this is what I get when I check the error log (a part or two might be odd because I translated to English):

WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') AND (2u98_posts.post_author <> 77777 OR ( (2u98_term_taxonomy.taxonomy = "...' at line 3 for query SELECT SQL_CALC_FOUND_ROWS 2u98_posts.ID FROM 2u98_posts LEFT JOIN 2u98_term_relationships ON (2u98_posts.ID = 2u98_term_relationships.object_id) LEFT JOIN 2u98_term_taxonomy ON ( 2u98_term_relationships.term_taxonomy_id = 2u98_term_taxonomy.term_taxonomy_id ) WHERE 1=1 AND ( 2u98_term_relationships.term_taxonomy_id IN (152) ) AND ( (2u98_term_taxonomy.taxonomy = "author" AND 2u98_term_taxonomy.term_id = '345')) AND 2u98_posts.post_type = 'post' AND (2u98_posts.post_status = 'publish' OR 2u98_posts.post_status = 'queued' OR 2u98_posts.post_status = 'processing' OR 2u98_posts.post_status = 'hold') AND (2u98_posts.post_author <> 77777 OR ( (2u98_term_taxonomy.taxonomy = "author" AND 2u98_term_taxonomy.term_id = '345')) AND EXISTS (SELECT 1 FROM 2u98_postmeta WHERE 2u98_postmeta.post_id = 2u98_posts.id AND 2u98_postmeta.meta_key = "_wp_attachment_metadata"))) AND (2u98_posts.post_author <> 77777 OR ( (2u98_term_taxonomy.taxonomy = "author" AND 2u98_term_taxonomy.term_id = '345')) AND EXISTS (SELECT 1 FROM 2u98_postmeta WHERE 2u98_postmeta.post_id = 2u98_posts.id AND 2u98_postmeta.meta_key = "_wp_attachment_metadata"))) GROUP BY 2u98_posts.ID ORDER BY 2u98_posts.post_date DESC LIMIT 0, 5 made by require('wp-blog-header.php'), wp, WP->main, WP->query_posts, WP_Query->query, WP_Query->get_posts

How to reproduce “resource busy and acquire with NOWAIT specified or timeout expired ” error on local machine in oracle

I am running oracle database and I am getting error as "resource busy and acquire with NOWAIT specified or timeout expired " and because of this error i am getting some other exceptions. on my local machine I am not getting this "resource busy …" error. basically I want to reproduce this error on my local machine . is there any way to reproduce this error manually on my local machine?